Constant idle CPU usage was really bothering me, especially it’s unpredictability: sometimes it would consume 10% of a core, sometimes 35%. So, I simply decided to quit Plex on a command or after a timeout, and start it again when any key is pressed:
- Create
~/wait.sh:
#!/bin/bash
tvservice -o
dd if=/dev/input/event0 of=/dev/null count=1
tvservice -p
- Run
systemctl edit plexht, enter the following snippet:
[Service]
ExecStart=
ExecStart=/bin/sh -c ". /etc/profile; /storage/wait.sh; exec /usr/lib/plexht/plexhometheater -fs $PLEXHT_ARGS $PLEXHT_DEBUG"
- In Plex preferences set “Shutdown function” to “Quit” and timer to 15 minutes
- Added to keymap a shortcut for
XBMC.Quit()
A couple of additional notes:
-
/dev/input/event0is a keyboard device, might be different if there are multiple devices - tvservice invocations needed to disable/enable hdmi. Alternatively, some kind of placeholder image can be written into
/dev/fb0, or just leave it as is: black screen. - If you do not need autoquitting after a timeout, add the
--standaloneoption to plexhometheater arguments. It is there by default, but I removed it because it affects “Shutdown function” options.