How to catch and interpret CEC signal from TV @LibreELEC

  • Didnt find anything in this thread yet, so I wonder, if following workaround is doable:

    Add option to shutdown/startup kodi service (systemctl) to the usual Sleep/Hibernate functions. So it could be assign for example to CEC TV turn on/off actions. Or additionaly also by keypress through lirc/remote?

    Not sure if this is possible (especially turn-on) part, ie. if using Lirc/remote.xml (maybe lircd) need kodi service running to process keypress. And the same thing for CEC..

    Is this total nonsense, or something, what could be done?

    2x VIM3L, 3x X96 Air P3, 6x C2; 6x RPi2; 3x Win7 Kodi + vPeter's mariaDB plugin as Library DB

    Edited once, last by JimmySmith ().

  • For IR you can use irexec.

    For keyboard I was using actkbd to restart kodi when kodi become non-responsive. (Gladly it is not needed anymore for last few months.)

    No idea for CEC (only tested few times).


  • Thanks.. That sounds promising and propably deserves some digging :)

    Triggering events manually (need to use two more buttons, but better than 20% CPU all the time)

    Keyboard input

    I dont use keyboard anywhere, from the quick google seems that actkbd would must be ported.

    IR remoted environments looks easy:

    Create /storage/.config/lircrc

    prog = irexec
    button = KEY_UP
    config = systemctl start kodi
    prog = irexec
    button = KEY_DOWN
    config = systemctl stop kodi

    lircrc deamon isnt started in LE automatically, when lircrc is present, so we need to start it via / etc

    irexec -d /storage/.config/lircrc

    CEC-related inputs:

    I think libCEC should handle inputs even when Kodi service is down - otherwise I dont know, how would be possible to wakeup sleep/hibernated device through it. How to catch input and execute command is another thing.. I look on the Input-libCEC settings, but I dont see there CEC related option, how to "wake-up" Kodi box, when TV is turned ON. Correct me please, if I am mistaken.

    Next big question is, if this could be

    Automated solution

    Shutdown Kodi - I can imagine grep kodi.log, to find, if there is inactivity, or use some Addon (1 / 2) to trigger stop action instead screensaver etc.

    Startup Kodi - Here is really troublemaker. Only thing I imagine there is CEC environments, so Kodi would be started (ie. script would be called) when connected TV is turned ON. But here I am struggling still. How to catch and interprete CEC command: outside Kodi, but just on Linux LibreELEC level?

    2x VIM3L, 3x X96 Air P3, 6x C2; 6x RPi2; 3x Win7 Kodi + vPeter's mariaDB plugin as Library DB

    Edited 7 times, last by JimmySmith ().