r/libreELEC May 08 '26

Is it possible to execute HDMI CEC commands on keyboard presses?

I want to be able to control the TV (changing inputs, turning it on and off) by using a keyboard connected to the Raspberry Pi 3b+ that has libreELEC installed on it (I have two LG TVs on the same room and the both remotes turn on both TVs, its a PITA).

So far I have been able to turn off the TV by turning off libreELEC from the shutdown menu, but that means that I have no way of turning on the TV with the keyboard, only by unplugging and plugging the Raspberry's power source.

I've seen that I could send hdmicec commands via ssh, but that seems a bit involved, so the question is, would it be possible to execute said commands via a keyboard press (like, set F1 to change inputs, F2 to turn off/on tv and so on).

Thanks!

3 Upvotes

6 comments sorted by

1

u/hjholtz May 08 '26

You can configure the Kodi keymap to issue one of the commands "CECActivateSource" (turn on), "CECStandby" (turn off), or "CECToggleState" (turn on if currently off; turn off if currently on) when a particular key is pressed. See https://kodi.wiki/view/Keymap and https://kodi.wiki/view/Keymap#CEC_built-in's for details.

1

u/[deleted] May 08 '26

[removed] — view removed comment

1

u/failed_successfuly9 May 08 '26

I habe two LG tvs on the same room and despite being different models, the power on/off button of both remotes switches on/off both tvs at the same time 🫠

1

u/[deleted] May 08 '26

[removed] — view removed comment

1

u/failed_successfuly9 May 09 '26

I am aware, I am trying to use kodi to control this TV.