You are running multiple OpenELEC systems with mixed hardware (PCs like Zotac Zbox, ARM devices like Raspberry Pi) and different HDMI displays (TV or PC monitors).

You maybe run a server where you use advancedsettings.xml to substitute paths to, like for userdata or remote.xml, if you use the same USB remote control for every device.

The files on the clients are quite the same everywhere, so for additional devices you only have to copy an image.

Main problems with controlling monitors and suspend

You need the USB remote to stay always active to catch “Power On” signals. This works for common PCs which are sent to sleep instead of full shutdown, but the Raspberry Pi does not have a suspend feature. According to some forum threads, there is a “virtual suspend” being worked on, but not yet finished.

Another problem appears if some monitors are CEC capable and some are not. E.g. most current TVs support CEC, but no common PC monitor. For the latter, it would be enough to just switch off the HDMI port, most displays go into sleep mode then.

One solution could be creating individual remote.xml files for every system, but imho this is not a clean way.

Workaround script

I created a script which you can download below. You might have to fit it according to your environment. I use it for the following combinations:

  • various Zotac ZBox IDxx (standby compatible; no CEC but using Pulse-Eight HDMI adapter)
  • various Raspberry Pi Model B, B+ and 2 (integrated CEC; no standby mode)
  • various TVs like Philips, Grundig (all CEC compatible)
  • various PC monitors like Benq 27″ (no CEC)

This happens in the script when you turn OpenELEC / Kodi on or off:

  • CEC TV with RPi: TV is switched off, RPi keeps running with Kodi closed
  • PC monitor with RPi: HDMI port is switched off, display goes into sleep mode, RPI keeps running with Kodi closed
  • CEC TV with PC: TV is switched off, PC goes into standby
  • PC monitor with PC: Monitor goes into sleep mode (missing HDMI signal because of PC sleep)


  1. Download the script: onOffHelper
  2. Extract and save it to /storage/.kodi/userdata/ Alternatively copy it to \\[yourOESystem]}UserData or distribute it like in this tutorial.
  3. Edit your remote.xml, located under /storage/.kodi/userdata/keymaps. If you do not have this file or want to use the addon Keymap Editor, start it and delete the mapping of the Power key. You can also copy the whole original file from /usr/share/kodi/system/keymaps/remote.xml to /storage/.kodi/userdata/keymaps. Anyway, in any case the <power> tag should not contain anything:

  4. Create file /storage/.kodi/userdata/.lircrc and add:

  5. User command “irw” to get your KEY_XX power button name if it does not work.
  6. Create or edit /storage/.config/ and add:

  8. Give the main scripts execution permissions:

  10. Reboot and you should be done
  11. Test it, e.g. press power button of your remote or run the script manually
  12. You might want to check logs in /storage/.kodi/temp/onOffHelper.log


Note: The locations I used might not be the best ones, but in most cases they seem to be the most comfortable to use for deploying.

Recommended GUI settings

If the monitor of the station is not CEC compatible, disable the CEC device (if available) under Kodi GUI -> Settings -> System -> Input Devices. So the script gets the information whether it should use CEC or only power off HDMI (e.g. on Raspberry Pi).

If your TV is CEC compatible, make sure you set the appropriate settings for your devices (setting “enabled” and your required actions what should be done on startup and standby/shutdown).

Default shutdown setting in GUI should be “Suspend”. If the setting is not available, you can try this.

In OE System settings, make sure you have set “default shutdown action” not to shutdown, but e.g. to suspend or completely off.

When editing .lircrc, you might also want to add a button for reboot, so can restart your system even if Kodi is hanging:


As soon as devices like Raspberry Pi get an official “virtual suspend” feature in OpenELEC or Kodi, please remove this script 🙂


For testing purposes

If you encounter problems using the script, have a look at the code snippets below, maybe they are useful for your environment:



Update 2015-11-25: Added command “tvservice -p” to script. This seems to be needed from OpenELEC v6 upwards on RPi. Also the script now supports custom autostart and shutdown files or commands.

Update 2016-02-29: Added additional “standby 0” CEC command to script. The default Kodi shutdown call seems to not always work with all CEC compatible TVs. E.g. for Grundig TVs, this bugfix might help you.

  [email protected]