[HowTo] Power off display by screensaver and remote control

Motivation

I wanted to be able to turn off my tv by pressing a button on my OSMC remote control. I also wanted my tv to automatically turn off after a certain time. There is already a screensaver addon by asavah but this does not work on OSMC out of the box as vcgencmd is missing. So I adapted the addon to work with OSMC by using the cec-client command.

Install the screensaver

  • Get the screensaver.osmc.displaypower-master.zip from https://github.com/mirrom/screensaver.osmc.displaypower
  • Install it via Add-ons > Add-on browser > Install from zip file > Select screensaver.osmc.displaypower-master.zip
  • Activate it via Settings > Interface settings > Screensaver > Screensaver mode > OSMC Display Power
  • Test it via Preview (wait until your display has powered off completely before pressing a button again)

Add custom keymap

Below code maps the home button of the OSMC remote to activate the screensaver.

On the terminal, enter nano /home/osmc/.kodi/userdata/keymaps/remote.xml and add

<keymap>
  <global>
    <remote>
      <start>ActivateScreensaver</start>
    </remote>
  </global>
</keymap>

Depending on your remote you may want to use a different button for turning off the display. You can find all available buttons in the remote.xml of the Kodi source code. Just replace <start>ActivateScreensaver</start> with the button of your choice.

Finally reboot OSMC to reload the key mappings.

Tested on Vero 4K with OSMC 2017.03-1

1 Like

Thanks! Listening radio/music lots of hours everyday so turning off TV this 2 ways is just what I needed : )

All version of the OSMC remote are received as keyboard input as of the long-press update so the keymap above would now be…

<keymap>
  <global>
    <keyboard>
      <escape>ActivateScreensaver</escape>
    </keyboard>
  </global>
</keymap>

Although i’m a bit unsure of the advantage over just using the “CECStandby” action in the keymap and skipping the special screensaver. The OSMC remotes currently have CEC power on and off keymapped to short and long press of the home button when you are on the home screen.