If anyone is desperate for a power saving feature - no matter how clunky - you might want to give the following script a go. It's been tested on the latest OpenELEC Gotham and Raspbmc builds.
Does work with OpenELEC Frodo 3.x.x builds, however
requires an extra hack to work around a couple of problems with OpenELEC Frodo.
Installation
SSH into your OpenELEC Pi as root, then run the following commands:
Code:
curl -Ls http://is.gd/XGXbTG -o /storage/texturecache.py
chmod +x /storage/texturecache.py
echo "(sleep 20 && /storage/texturecache.py @logfile= @xbmc.host=localhost rbphdmi) &" >> /storage/.config/autostart.sh
sync
reboot
And for Raspbmc owners:
Code:
wget -q http://is.gd/XGXbTG -O ~/texturecache.py
chmod +x ~/texturecache.py
~/texturecache.py @logfile= @xbmc.host=localhost @bin.tvservice=/opt/vc/bin/tvservice rbphdmi
(Not entirely sure what options Raspbmc owners have for automatically starting a script at boot - TBC).
The script is normally silent, but if you add @debug=yes to the command line it will generate some output, eg.:
Code:
Nov 26 10:01:39 rpi512 sh[1429]: [rbphdmi] Connecting to XBMC...
Nov 26 10:01:39 rpi512 sh[1429]: [rbphdmi] HDMI power management thread - initialising XBMC and HDMI state
Nov 26 10:01:39 rpi512 sh[1429]: [rbphdmi] HDMI is [on], Screensaver is [inactive], Player is [inactive], Library scan [inactive]
...
Nov 26 10:03:03 rpi512 sh[1429]: [rbphdmi] Screensaver has activated
Nov 26 10:03:03 rpi512 sh[1429]: [rbphdmi] HDMI power off in 900 seconds unless cancelled
...
Nov 26 10:10:25 rpi512 sh[1429]: [rbphdmi] Screensaver has deactivated
Nov 26 10:10:25 rpi512 sh[1429]: [rbphdmi] HDMI power-off cancelled
...
Nov 26 10:11:36 rpi512 sh[1429]: [rbphdmi] Screensaver has activated
Nov 26 10:11:36 rpi512 sh[1429]: [rbphdmi] HDMI power off in 900 seconds unless cancelled
...
Nov 26 10:26:36 rpi512 sh[1429]: [rbphdmi] HDMI has been powered off
...
Nov 26 10:27:44 rpi512 sh[1429]: [rbphdmi] Screensaver has deactivated
Nov 26 10:27:44 rpi512 sh[1429]: [rbphdmi] HDMI has been powered on
Nov 26 10:27:44 rpi512 sh[1429]: [rbphdmi] Sending Application.Quit() to XBMC
Nov 26 10:27:44 rpi512 sh[1429]: [rbphdmi] Disconnected from XBMC - waiting for restart
Nov 26 10:27:59 rpi512 sh[1429]: [rbphdmi] Connecting to XBMC...
Nov 26 10:27:59 rpi512 sh[1429]: [rbphdmi] HDMI power management thread - initialising XBMC and HDMI state
Nov 26 10:28:00 rpi512 sh[1429]: [rbphdmi] HDMI is [on], Screensaver is [inactive], Player is [inactive], Library scan [inactive]
...
To view these lines, use the following commands:
OpenELEC Gotham:
Code:
journalctl --follow | grep rbphdmi
OpenELEC Frodo:
Code:
tail -f /var/log/messages | grep rbphdmi
Remember there is a 20 second delay before the script starts (when using OpenELEC), as it needs to wait until the JSON RPC server is enabled. Increase this "sleep" value if your system is slower to start. You'll also need to enable the following two options in Settings -> Services -> Remote control:
Code:
Allow programs on this system to control XBMC
Allow programs on other systems to control XBMC
If you also want CEC control whenever HDMI is disabled or enabled, see the instructions in
post #17.
This is not an addon or a screensaver, it's a script (daemon) that monitors JSON notifications and when it sees that the screensaver has been activated it starts a timer that will, when it elapses (default 900 seconds), remove HDMI power with a call to "tvservice --off".
If the screensaver is deactivated before the timer has elapsed, the timer is cancelled and the system continues normally.
When the screensaver is deactivated through user activity and HDMI power is off, the HDMI power will be restored (tvservice --preferred) followed by a JSON call to Application.Quit() so that XBMC terminates and is automatically restarted - not rebooted - and the EGL context restored. This takes about 15 seconds from deactivating the screensaver to the menu re-appearing on a 1GHz Pi running a nightly build of OpenELEC Gotham.
Update: When using Raspberry Pi firmware from 23 May 2014 onwards (check with vcgencmd version), "vcgencmd display_power 0" and "vcgencmd display_power 1" will be used to disable/enable HDMI as this method does NOT require xbmc.bin to be restarted. See
this post for further details.
Configure the delay between the screensaver starting and HDMI power being terminated by specifying a value (in seconds) in /storage/.config/autostart.sh, for instance if you want a delay of 30 minutes (1800 seconds) change the line to:
Code:
(sleep 20 && /storage/texturecache.py @logfile= @xbmc.host=localhost rbphdmi 1800) &
Yes, it's a clunky solution but hey, it does at least work and until there's a proper solution, it's all there is!