Controlling projector/tv via raspberry pi 5 CEC and SSH

I am currently trying to set up my homey so that it can fully control my projector via raspberry media centre.

-Turn projector on off.
-Change HDMI input.

Raspberry Pi 5 is set up with libreElec with Kodi. CEC works with SSH commands. I can currently turn the projector on and off. However, I am struggling with CEC for HDMI input.

So far:
I used this method to get CEC control:

The 2024 answer relies on modern HDMI-CEC implementation, for instance the package v4l-utils and specifically its cec-ctl command. Having it to work is a matter of putting a


in your /boot/config.txt file and this gives you a /dev/cec0 device for your first HDMI port. Then you can execute some topology-discovery command like

Then I used these commands to control the projector:

On: cec-ctl -s -t0 --image-view-on

Off: cec-ctl -s -t0 --standby

So now it boils down to getting HDMI input control. I need to switch between the chromecast and the raspberry Pi. And I really don’t want to use the remote control.

Does anyone know how to do it?

maybe you can use: Desktop Device App for Homey | Homey ?

That looks like a nice app. But I’m not sure it will help me to control HDMI inputs over CEC.
This may not be the right forum for it, but I’m sure there are others who has the same issue in controlling their AV equipment with homey. Simple SSH app seems to work well in conveying commands to the raspberry. So basically my setup works well enough, I just lack a away to control which HDMI input the projector uses.

So really this is a CEC issue atm and not a homey issue. But it would be nice to have all the information gathered here so that if anyone else wants to set up a mediacentre with homey it will be pretty straight forward.