I find it very desirable for my TV to turn off after the screensaver has been running for a while so my TV doesn’t accidentally stay on all night. I’ve been using texturecache.py to do this. Among other things it allows you to set the amount of time your screensaver runs before turning off the HDMI (and thus your TV after a few minutes)
Here’s how to get everything working:
Install texturecache.py:
wget -q http://is.gd/XGXbTG -O ~/texturecache.py
chmod +x ~/texturecache.py
Create systemd timer & service files:
/etc/systemd/system/texturecache.timer
[Timer]
OnBootSec=60
[Install]
WantedBy=multi-user.target
/etc/systemd/system/texturecache.service
[Unit]
Description=Texturecache Daemon
After=mediacenter.service texturecache.timer
[Service]
User=osmc
Group=osmc
Type=simple
ExecStart=/usr/bin/python /home/osmc/texturecache.py @bin.vcgencmd=/opt/vc/bin/vcgencmd @logfile=/home/osmc/texturecache.systemd.log @xbmc.host=localhost @bin.tvservice=/opt/vc/bin/tvservice rbphdmi 1800 &
TimeoutStopSec=20
Restart=on-failure
RestartSec=60
StartLimitInterval=60s
[Install]
WantedBy=multi-user.target
(To adjust the time the screensaver runs change the 1800 (30 minutes) to however many seconds you prefer. I now have mine set at 3600 (60 minutes))
Both timer and service need to be enabled:
sudo systemctl enable texturecache.service
sudo systemctl enable texturecache.timer
If everything works right, the texturecache.timer waits 60 seconds after boot, then starts texturecache.service, which runs texturecache.py! I’ve just updated the .service file to restart the service when it fails while OSMC is installing updates.
Enjoy!
More info on texturecache.py can be found here: GitHub - MilhouseVH/texturecache.py: Utility script to manage the XBMC texture cache