Linux [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136) +---- Thread: Linux [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend (/showthread.php?tid=115758) |
[RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2011-11-29 First of all, I’m not shure if this is the right place for announcment or maybe the next subforum (Python development), second I thank nmcaullay for inspiration and parts of source code from his pvruptime-addon (see http://forum.xbmc.org/showthread.php?p=725958#post725958) and at least, sorry for my bad english. Ok lets go! Download and screenshots you'll find at (new download location): http://vdr4bj1.no-ip.org?item=addon or install it from my repository (see signature) Description: The combination of XBMC/Kodi(Buntu) and TVHeadend as backend hasn’t a power or timer management for ongoing and upcoming recordings. A wake-up mechanism for future recordings either under XBMC nor under TVHeadend isn't completed yet or needs several bash scriptings. Therefore I've written a Python-Script, which is registered as a service on XBMCKodi running since Frodo up to actual versions. The operation of this script can be summarized as follows:
"Soon" fitting timers are calculated from: ACPI: Recording Time < boot time + shutdown time + countdown time -> see screenshot NVRAM: <11 minutes Inside the package is a wrapper script (shutdown.sh) that needs some special settings as python itself cannot have root privileges. This is necessary for setting the system clock and shutdown operations. Therefore: YOU MUST read the README and follow the instructions whitin the package, because there's a lot to be configured (user rights, remote.xml, etc.). Just take a look inside the zipfile. It would be grateful to inform me about errors, issues or other informations. Be free to contact me in this forum or PM me. _BJ1 ____________________________________________________________________ Current Release: see changelog Initial Release Oct. 2011 Installation: Copy zip to a directory where XBMC has access. Then: System -> Addons -> Install from zip file -> select location Next steps for configuration you'll find in the README in this package. - ronnylov - 2011-12-07 This is exactly what I need! I will try it on my htpc rebuild and see how it works. Thank You! time or hwclock problem - fecus - 2011-12-20 I try to use your addon. I have media PC based on ASUS M3N78-EM mainboard. I have problem with PC wake up. This is the log: 2011-12-20 20:05:32.106721: PVR Manager: next recording in 68 minutes 2011-12-20 20:05:32.106919: PVR Manager: service driven by User 2011-12-20 20:05:32.129694: PVR Manager: Wakeup by ACPI at 2011-12-20 21:13:32.$ 2011-12-20 20:05:32.129857: PVR Manager: Instruct the system to shut down 2011-12-20 20:05:34.217110: PVR Manager: service finished 2011-12-20 20:08:20.377772: PVR Manager: next recording in 65 minutes 2011-12-20 20:08:20.389005: PVR Manager: service driven by User 2011-12-20 20:08:20.448837: PVR Manager: no PIDFile, system powered on first ti$ 2011-12-20 20:08:20.449872: PVR Manager: service finished And the time and hwclock: rtc_time : 20:10:28 rtc_date : 2011-12-20 alrm_time : 20:13:32 alrm_date : 2011-12-20 alarm_IRQ : no alrm_pending : no update IRQ enabled : no periodic IRQ enabled : no periodic IRQ frequency : 1024 max user IRQ frequency : 64 24hr : yes periodic_IRQ : no update_IRQ : no HPET_emulated : yes BCD : yes DST_enable : no periodic_freq : 1024 batt_status : okay root@Mediapc:/# date 2011. dec. 20., kedd, 20.10.32 CET root@Mediapc:/# date -u 2011. dec. 20., kedd, 19.10.35 UTC root@Mediapc:/# The IRQ not set and the alarm time less than I need. I try this small script: echo 0 > /sys/class/rtc/rtc0/wakealarm echo `date -d "2011-12-20 21:13:32" +%s` > /sys/class/rtc/rtc0/wakealarm cat /sys/class/rtc/rtc0/wakealarm Nothing good: rtc_time : 20:14:01 rtc_date : 2011-12-20 alrm_time : 20:18:52 alrm_date : 2011-12-20 alarm_IRQ : no After I try this: echo 0 > /sys/class/rtc/rtc0/wakealarm echo `date -u -d "2011-12-20 21:13:32" +%s` > /sys/class/rtc/rtc0/wakealarm cat /sys/class/rtc/rtc0/wakealarm root@Mediapc:~# ./wake_test 1324415612 And the rtc settings are good: rtc_time : 20:16:01 rtc_date : 2011-12-20 alrm_time : 21:13:32 alrm_date : 2011-12-20 alarm_IRQ : yes alrm_pending : no Are there any problem with UTC or local time? I'm not a programmer, and sorry for my english. Can you help me? - _BJ1 - 2011-12-21 Yes, you have to set your system to UTC. Is the system powered on with the 'good settings' (wake_test)? _BJ1 To tell your Ubuntu system that the hardware clock is set to UTC: 1. edit /etc/default/rcS 2. add or change the following section # Set UTC=yes if your hardware clock is set to UTC (GMT) UTC=yes - fecus - 2011-12-21 _BJ1 Wrote:Yes, you have to set your system to UTC. Is the system powered on with the 'good settings' (wake_test)? Yes. The system started properly. I set it before this log: UTC= yes, but it does not solve. Before this try, I change the rtc clock to UTC clock. It does not help. It works only with -u parameter. The BIOS time is UTC. - _BJ1 - 2011-12-21 Ok. Will try to find a solution _BJ1 - _BJ1 - 2011-12-21 Same output as yours: xbmc@Echnaton:/$ date Wed Dec 21 17:53:23 CET 2011 xbmc@Echnaton:/$ date -u Wed Dec 21 16:53:29 UTC 2011 xbmc@Echnaton:/$ But for me it works... _BJ1 EDIT: Goto : ~/.xbmc/addons/script.program.pvrmanager/resources/lib and edit the shutdown.sh Change: echo $2 > /sys/class/rtc/rtc0/wakealarm to: echo `date -ud @$2` > /sys/class/rtc/rtc0/wakealarm Hope this works. - _BJ1 - 2011-12-22 Wow, needed help but no feedback. So I'm trapped in the dark... _BJ1 - fecus - 2011-12-23 _BJ1 Wrote:Wow, needed help but no feedback. So I'm trapped in the dark...Wait a minute! I have no time every day to do my hobby. I change shutdown.sh as you said, but it does not work. I can't shutdown system at all. I changed it back. After I comment the last line in shutdown.sh. In this way I trying it without really shutdown. I change the rtc time with "hwclock --localtime" command to localtime. After this the rtc accept the date and time and wake up system. Now, I have one success record. Unfortunately it didn't switch off after the record. I don't understand exactly what was the really solution. I wait some other success records. I think very important the relationship of RTC, local time, BIOS time, UTC. Thank you for your help! - _BJ1 - 2011-12-23 fecus Wrote:Unfortunately it didn't switch off after the record. I don't understand exactly what was the really solution. I wait some other success records. I think very important the relationship of RTC, local time, BIOS time, UTC. Thanks for information. I don't know why it didn't switch off after record. Perhaps a remote key pressing whilest recording? Look into log (pvrmanager.log) around the poweroff-time... _BJ1 - fecus - 2011-12-24 The life isn't easy. The ubuntu update files. I never do it again. New xbmc.bin arrived. Now, the xbmc display error with shutdown.sh.: 12:21:18 T:2980039536 ERROR: Error Contents: ('invalid syntax', ('/home/fecus/.xbmc/addons/script.program.pvrmanager/resources/lib/shutdown.sh', 2, 7, 'sleep 2\n')) 12:21:18 T:2980039536 ERROR: SyntaxError: ('invalid syntax', ('/home/fecus/.xbmc/addons/script.program.pvrmanager/resources/lib/shutdown.sh', 2, 7, 'sleep 2\n')) It doesn't finish the power down. - _BJ1 - 2011-12-24 It fails on the very first instruction into the shutdown.sh. Are executable rights, owner and group changed for the shutdown.sh? Also, looks the first line like: #! /bin/sh ? Merry Christmas. _BJ1 - fecus - 2011-12-25 _BJ1 Wrote:It fails on the very first instruction into the shutdown.sh. Are executable rights, owner and group changed for the shutdown.sh? Also, looks the first line like: I reinstall, and re-set the rights. Nothing work. Is it a python interpreter problem? - _BJ1 - 2011-12-26 fecus Wrote:Is it a python interpreter problem? The shutdown.sh is an usual shellscript. Who is the user running xbmc? Maybe there are permissions. _BJ1 - fecus - 2011-12-26 _BJ1 Wrote:The shutdown.sh is an usual shellscript. Who is the user running xbmc? Maybe there are permissions.It has 3 user : mythtv, fecus, hts Before upgrade I added the xbmc to autorun programs and clear mythTV frontend. (This was the Mythbuntu install, originally) I set the rights - as you wrote - for fecus, and everithing work. After upgrade something change. In remote.xml: <power>XBMC.RunScript(script.program.pvrmanager)</power> visudo: ### XBMC specific configuration ### # XBMC Cmnd_Alias PVR_CMDS = /home/fecus/.xbmc/addons/script.program.pvrmanager/resources/lib/shutdown.sh fecus ALL=NOPASSWD: PVR_CMDS # XBMC Rights of default.py: owner: fecus group: fecus 100755 Rights of shutdown.sh: owner: fecus group: fecus 100755 Rights of xbmc.bin: owner: root group: root 100755 I don't have more idea. I'm sorry for this disturbing and Merry Christmas! |