Sleep/wake function based on HDMI signal input

  • The problem is that KODI keeps running when I turn off my TV which means that it consumes power and also a large amount of streaming bandwidth for IPTV. I am currently using KODI/LibreELEC on a Pi4 on my SAMSUNG TV to watch IPTV and SMB files, but this feature would still be useful to anyone using HDMI.

    KODI has a "Put display to sleep when idle" function, but I propose that KODI also adopt a "Sleep/wake based on HDMI signal input" function. The sleep function would initiate after XX minutes of no detection of a HDMI signal, and it would wake from sleep instantly after detecting a HDMI signal.

    This would be phenomenally helpful because it would allow me to turn off my TV and have KODI go to sleep, saving power and bandwidth.

    (Originally erroneously posted to Kodi forum.)

  • Hi, I'm trying to understand what do you want... When you pressing the "Power" button on the TV remote, switching off the TV, want to the Kodi/LE to detect it via HDMI cable and to send a general "Stop" command to Kodi to stop all media playings ("saving power and bandwidth")? Because you often forget to stop the player before to switch of the TV?

  • Quote

    want to the Kodi/LE to detect it via HDMI cable and to send a general "Stop" command to Kodi to stop all media playings

    Can LibreELEC kernel detect whether a display is turned on or off via HDMI?

    If so, I propose that LibreELEC constantly monitors display status and forces Kodi to go into "low power mode" when it detects that the display has been off for XX minutes (perhaps 5 minutes). Also I propose that LibreELEC forces Kodi to wake from "hibernation mode" and/or "low power mode" instantly when it detects that the display has been turned back on.

    HOWEVER, your idea is good as well and will accomplish my needs. Can we do it?

  • I'm using an unusual solution for this. Because I had too many issues with HDMI-CEC, I connected an IR receiver and an IR LED to the RPi's GPIO. Now I'm using an MCE IR remote to control the LE, with modified function of the remote "power" button, when is pressed, first send a "Stop" command to the Kodi, then send few times the propper "power" signal to the TV thru IR LED. I'm using same button to switch on the TV, just need to be pressed twice (first to wake up the Kodi).

  • If so, I propose that LibreELEC constantly monitors display status and forces Kodi to go into "low power mode" when it detects that the display has been off for XX minutes (perhaps 5 minutes). Also I propose that LibreELEC forces Kodi to wake from "hibernation mode" and/or "low power mode" instantly when it detects that the display has been turned back on.

    This is already implemented via HDMI CEC. If I turn TV off, Kodi detects this via CEC and sends suspend signal to system immediately (no delay). Wakeup is much more complex, since it depends on SoC and its drivers. Whole procedure once worked on Allwinner SoCs (except R40), but wakeup via CEC is currently broken for some reason...

    In other words, sleep part is already implemented, but you don't want it if wakeup part isn't implemented and here is the issue - only some platforms implements that.

    Pi4 AFAIK doesn't have power management implemented in kernel.

  • This is already implemented via HDMI CEC. If I turn TV off, Kodi detects this via CEC and sends suspend signal to system immediately (no delay). Wakeup is much more complex, since it depends on SoC and its drivers. Whole procedure once worked on Allwinner SoCs (except R40), but wakeup via CEC is currently broken for some reason...

    In other words, sleep part is already implemented, but you don't want it if wakeup part isn't implemented and here is the issue - only some platforms implements that.

    Pi4 AFAIK doesn't have power management implemented in kernel.

    This is correct, I have noticed that the system is suspended upon TV standby via HDMI CEC. But will not wake up, thus requiring a manual reset of the Pi4.

    I take it the suspend function via CEC can be disabled via the CEC adapter in the peripherals menu?