Forums » Tutorial and setups »
tvheadend<>Kodi - hot to wake up for recording from hibernation and after recording go back to hibernation?
Added by Jef Bosk almost 7 years ago
Hello everybody,
I am setting up my tvheadend with Kodi piece by piece and have now achieved, that tvheadend and my tuner Cine S2 from Digital Devices work after resume from hibernation. I achieved this by doing as described here [[https://wiki.ubuntuusers.de/DVB-Karten/Digital_Devices_Cine_S2/]]. Sorry it's a thread in German, but anyway, it says to save the following script under /etc/systemd/system/ddbridge-sleep.service (where ddbridge-sleep.service is the name of the file I created)
[Unit]
Description=Restart tvheadend and ddbridge
Before=sleep.target
StopWhenUnneeded=yes
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/systemctl stop tvheadend.service ; /sbin/modprobe -r ddbridge cxd2099 dvb_core
ExecStop=/sbin/modprobe ddbridge cxd2099 dvb_core ; /bin/systemctl start tvheadend.service
[Install]
WantedBy=sleep.target
After sending the pc manually to hibernation and resuming, TV works fine after waiting few seconds.
Now the next obstacle: I followed this HowTo: [[https://tvheadend.org/projects/tvheadend/wiki/Wakeup]] where I moved to point 4. knowing that my pc (apart from the missing wifi), tvheadend and Kodi work fine after resuming from hibernation. I created the following script and saved it under /etc/pm/sleep.d/95_timer.sh
#!/bin/bash #- set ACPI Wakeup alarm
- safe_margin - minutes to start up system before the earliest timer
- script does not check if recording is in progress # #
echo 1 > /timer
- bootup system 180 sec. before timer
safe_margin=180
- modyfy if different location for tvheadend dvr/log path
cd ~hts/.hts/tvheadend/dvr/log
######################
start_date=0
stop_date=0
current_date=`date +%s`
for i in $( ls ); do
tmp_start=`cat $i | grep '"start":' | cut -f 2 -d " " | cut -f 1 -d ","`
tmp_stop=`cat $i | grep '"stop":' | cut -f 2 -d " " | cut -f 1 -d ","`
- check for outdated timer
if [ $((tmp_stop)) -gt $((current_date)) -a $((tmp_start)) -gt $((current_date)) ]; then
- take lower value (tmp_start or start_date)
if [ $((start_date)) -eq 0 -o $((tmp_start)) -lt $((start_date)) ]; then
start_date=$tmp_start
stop_date=$tmp_stop
fi
fi
done
wake_date=$((start_date-safe_margin))
echo $start_date >> /timer
echo $wake_date >> /timer
- set up waleup alarm
if [ $((start_date)) -ne 0 ]; then
echo 2 >> /timer
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $wake_date > /sys/class/rtc/rtc0/wakealarm
fi
The PC does not wakeup What am I doing wrong? I am also including to screenshots of my settings in Kodi, in case they help.
Actually I just want to use kodi like a real pvr with hibernation, wake up and hibernation after recording...this is turning out to be a veery complicated project and I start to miss my WIN7 with Mediaportal, everything was so easy there. But I still hope that you guys can help me getting my htpc running, before I throw in the towel.
Replies (1)
RE: tvheadend<>Kodi - hot to wake up for recording from hibernation and after recording go back to hibernation? - Added by Jef Bosk almost 7 years ago
I found help at the kodinerds forum.
I installed the addon PVR Recording and Power Manager. It's still not running 100% smoothly, but the cool guy who programmed the addon is working on it.
This thread can be considered here as closed.
Thanks anyway.