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 GitHub - mirrom/screensaver.osmc.displaypower: Screensaver for Kodi running on OSMC that turns display power off by using cec-client command. - 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