An extension to Tvheadend that will suspend your system when it is inactive and wake it right before the next scheduled recording.
Suspend can be configured to be one of
suspendhibernatehybrid-suspendandpoweroff
Activity means
- Tvheadend activity:
- Running or upcoming recordings
- Subscriptions, e.g. live TV or EPG grabbing
- Connected clients, e.g. Kodi or web interface
- System activity as defined in the Ubuntu AutoSuspend script, e.g.
- Running daemons
- Running applications
- Connected samba clients
- Reachable network clients
This script is based on systemd and does not make use of pm-utils. It has been tested on Debian 8 (Jessie) with Tvheadend build 4.0.8~jessie. It should work on systems that meet the dependencies listed below.
- systemd (part of Debian 8)
- A running Tvheadend service
- Copy the files from this git repository to your system.
- Install the dependencies
rtcwake(package util-linux, part of Debian 8)netstat(package net-tools, part of Debian 8)curlxmlstarletjq
On Debian based systems, dependencies may be installed using the command
$ sudo apt-get install util-linux net-tools curl xmlstarlet jq
Edit /etc/autosuspend according to your needs. Credentials for tvheadend are required, e.g.
# User for access to the Tvheadend REST API
TVHEADEND_USER=hts
# Password for access to the Tvheadend REST API
TVHEADEND_PASSWORD=hts
All other values are optional.
It is possible to work with an existing Tvheadend user, but I recommend to create a separate account to keep things clear. The following rights are required:
- Web Interface
- Admin
- Video Recorder
Details on the configuration of system activity can be found in the Ubuntu users wiki (german).