Kodi Community Forum

Full Version: Activate screensaver via remote control
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I've currently got xbmc set up so that when the screensaver activates, it turns off my TV and receiver via a hdmi-cec adapter. I would like to be able to press the power button on my remote to activate the screensaver (in turn turning off the tv and receiver), but I can't seem to figure out how to do this.

There doesn't seem to be a built in function listed here to activate the screensaver. My hope was that I could simply remap the power button in the Lircmap.xml file with a predefined function, but apparently it's not that simple.

Does a function exist to activate the screensaver?
In principle "ActivateWindow(screensaver)" will immediately turn on the screensaver, however I've just tried it and once activated the screensave won't deactivate. This makes it less than useful!
Indeed, I get the same result from that.

Under settings > appearance settings > screensaver, there is a "preview" option that does exactly what I'm looking for. Is there an easy way to figure out what exactly that "preview" option does, and then make the remote power button do that?
Don't know exactly what screensaver you want but i found this.
Code:
<keymap>
  <global>
    <keyboard>
      <p mod="alt">SlideShow(C:\MyPictures)</p>
    </keyboard>
  </global>
</keymap>
Alt+p starts slideshow of folder.
Thanks MassIV, I had also stumbled upon that one in my search. But starting a slideshow won't do what I'm looking for, as it won't turn my TV and Receiver off via the hdmi-cec adapter, which is the final goal of this endeavor.
So what exactly are you trying to do? Something like this?
Use python script to turn off tv and receiver when screensaver is active.
http://forum.xbmc.org/showthread.php?tid=134622

Or this?
http://forum.xbmc.org/showthread.php?tid=43184
http://trac.xbmc.org/attachment/ticket/5...aver.patch
Not quite either of those MassIV. Within the hdmi-cec settings it already turns off the tv and receiver when the screensaver activates. I want a button on my remote to activate the screensaver. Simple as that.
Hi,

I am also after this feature.
I want to activate the screensaver via python.

I have a script that I run when I press a button on my remote.
This script puts my hard-drive to standby & my PC to sleep.
I would then like it to activate the XBMC screensaver so LIBCEC detects this and turns off my tv Smile

Thanks,

Matt
I got a python script to turn off my TV Smile Smile


import subprocess
subprocess.call('echo "tx 10 36" | cec-client', shell=True)

Your command may be different. To find your command:

Turn on "turn off TV when screensaver active" in libcec XBMC settings
Turn on debugging. Then change your screensaver timeout to 1min.
Wait for XBMC to go to screensaver and turn off your TV.
Now, open your xbmc log and look for:

"
DEBUG: CecLogMessage - << putting 'TV' (0) in standby mode
DEBUG: CecLogMessage - << 10:36
"
The 10:36 is the command you want to use:
'echo "tx 10 36" | cec-client'

When I used cec-client -s - then my TV would not detect the XBMC CEC when turned back on. Removing the -s fixed this for me.

Hope this helps someone Smile

I guess you could use the debug log and pick up any other commands that you want to replicate via Python.
wow stanley87, thank you! (I have yet to test this, but I trust you). I guess you worked around some restrictions by using subprocess.

Out of curiosity, have you found a way to toggle the TV power? I'd like the same button on my remote to turn on _and_ off the TV. Maybe an if xbmc.getCondVisibility("System.ScreenSaverActive") thing or cec-client may be able to detect the TV state and act accordingly.