My suggestion is:
- Tvheadend maintains a systemd.timer (with the wake flag enabled)
- this timer gets updated either everytime the internal scheduled tasks change (i.e. the timer contains the date/time of the next task tvh needs perform, that copuld be recording or scan, or whatever...)
or in the tvh suspend task itself.
- whenever the timer is updated, don't forget to issue a systemctl daemon-reload
- and yes that works also in the tvh suspend unit
This way of way of setting a wake time when the system suspends works. Unfortunately, the drivers don't really like suspend resume, and even removing them on suspend, reloading them on resume doesn't seem to work properly. The dependencies are a mess (ddbridge, in my case).
Also, IMHO tvh should prevent sleep when it has do to something and reallow when idle (can be done via d-bus/logind).
what remains is who is responsible for putting the system to sleep, powertop?