Kodi Community Forum
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)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-09

Image

Thanks, will disable all resume by alarm wake up events when I get home from work (the image is now my live config).

Sorry but I don't speak German at all. Is there anything else I need to do other than disable wake alarm events in BIOS?


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-10

Hello again,

I disabled the resume by alarm in the BOIS as per your instructions and image posted previously and I'm afraid it made no difference? It all "looks" ok but doesn't actually wake up and i know this function does work if I manually set the time to wake up via command line and put the computer on suspend.

Any idea? I tried translating some of the german from the forum you posted but couldn't decipher anything meaningful...


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2015-11-10

Could you post a kodi.log (complete or the important parts) until shutdown? You'll find this after a new start as 'kodi.old.log'. You can select the important parts with the command

more ~/.kodi/temp/kodi.old.log | grep service.tvh.manager

on the terminal/console. Also be sure you have to enabeled the shutdown script (shutdown.sh) to execute shell commands with root privileges. See readme.pdf part 'visudo'. If your mainboard starts with RTC enabled it should be starting by the addon too.

Regards


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-10

Thanks, will post the log later on today. With regards to the VISUDO part, I'm using OpenElec so this stage isn't necessary?

I don't understand your last sentence "If your mainboard starts with RTC enabled it should be starting by the addon too." I have disabled 'Resume By Alarm' in the BIOS. Is there anything else I should enable/disable? As mentioned I can't see a problem with the BIOS as I can edit:

/sys/class/rtc/rtc0/wakealarm

and put in a time (e.g. 5 minutes later) and the computer wakes from Suspend. When I check using:

cat /proc/driver/rtc

and I can see the alarm_IRQ setting set to YES. Something that I never see with your script.

Thanks for all your prompt responses. WIll get back to to when I finish work.


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2015-11-10

The code for setting the wakealarm executes very late while system is shutting down. So you have no chance to read the rtc because system shuts down immediatly after that. Look at the shutdown.sh (https://github.com/b-jesch/service.tvh.manager/blob/master/resources/lib/shutdown.sh), there is:

echo 0 > /sys/class/rtc/rtc0/wakealarm # reset the rtc
echo $2 > /sys/class/rtc/rtc0/wakealarm # set the new wakeup time
shutdown -h now # shutdown immediatly


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-10

Kurosh-HTPC:~/.kodi/addons/service.tvh.manager/resources/lib # more shutdown.sh
#! /bin/sh
sleep 2
case "$1" in
ACPI)
echo 0 > /sys/class/rtc/rtc0/wakealarm
echo $2 > /sys/class/rtc/rtc0/wakealarm
;;
NVRAM)
nvram-wakeup -C /etc/nvram-wakeup.conf --directisa -s $2
;;
esac
case "$3" in
1)
shutdown -h now "TVHManager shutdown the system"
;;
esac
exit 0

Kurosh-HTPC:~/.kodi/addons/service.tvh.manager/resources/lib # chmod +x shutdown.sh

Kurosh-HTPC:~/.kodi/addons/service.tvh.manager/resources/lib # more ~/.kodi/temp/kodi.old.log | grep service.tvh.manager
07:33:30 T:140232888411904 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 237
07:33:31 T:140232888411904 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
07:33:31 T:140232888411904 NOTICE: [service.tvh.manager]: Service with id 237 finished
07:33:31 T:140232888411904 NOTICE: [service.tvh.manager]: Service with id 237 (V.0.3.2 on Kurosh-HTPC) kicks off
11:39:47 T:140230700537600 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 86
11:39:47 T:140230700537600 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
11:39:47 T:140230700537600 NOTICE: [service.tvh.manager]: Poweroff command received
11:39:47 T:140230700537600 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
11:39:53 T:140230700537600 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 08.11.15 19:47
11:39:58 T:140230700537600 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
11:39:58 T:140230700537600 NOTICE: [service.tvh.manager]: Service with id 86 (V.0.3.2 on Kurosh-HTPC) kicks off
18:18:33 T:140230816429824 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 1019
18:18:33 T:140230816429824 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
18:18:33 T:140230816429824 NOTICE: [service.tvh.manager]: Poweroff command received
18:18:33 T:140230816429824 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
18:18:33 T:140230816429824 NOTICE: [service.tvh.manager]: Countdown possibly invisible (fullscreen mode)
18:18:33 T:140230816429824 NOTICE: [service.tvh.manager]: Showing additional notification
18:18:34 T:140230917404416 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 515
18:18:34 T:140230917404416 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
18:18:34 T:140230917404416 NOTICE: [service.tvh.manager]: Poweroff command received
18:18:34 T:140230917404416 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
18:18:34 T:140230917404416 NOTICE: [service.tvh.manager]: Countdown possibly invisible (fullscreen mode)
18:18:34 T:140230917404416 NOTICE: [service.tvh.manager]: Showing additional notification
18:18:34 T:140230948538112 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 476
18:18:34 T:140230948538112 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
18:18:34 T:140230948538112 NOTICE: [service.tvh.manager]: Poweroff command received
18:18:34 T:140230948538112 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
18:18:34 T:140230948538112 NOTICE: [service.tvh.manager]: Countdown possibly invisible (fullscreen mode)
18:18:34 T:140230948538112 NOTICE: [service.tvh.manager]: Showing additional notification
18:18:44 T:140230816429824 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 08.11.15 19:47
18:18:49 T:140230816429824 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
18:18:49 T:140230816429824 NOTICE: [service.tvh.manager]: Service with id 1019 (V.0.3.2 on Kurosh-HTPC) kicks off
18:18:50 T:140230917404416 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
18:18:50 T:140230917404416 NOTICE: [service.tvh.manager]: Service with id 515 (V.0.3.2 on Kurosh-HTPC) kicks off
18:18:56 T:140230948538112 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
18:18:56 T:140230948538112 NOTICE: [service.tvh.manager]: Service with id 476 (V.0.3.2 on Kurosh-HTPC) kicks off
19:03:33 T:140230774474496 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 751
19:03:33 T:140230774474496 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
19:03:33 T:140230774474496 NOTICE: [service.tvh.manager]: Poweroff command received
19:03:33 T:140230774474496 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
19:03:39 T:140230774474496 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 08.11.15 19:47
19:03:44 T:140230774474496 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
19:03:44 T:140230774474496 NOTICE: [service.tvh.manager]: Service with id 751 (V.0.3.2 on Kurosh-HTPC) kicks off
14:07:47 T:140230923368192 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 377
14:07:47 T:140230923368192 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
14:07:47 T:140230923368192 NOTICE: [service.tvh.manager]: Poweroff command received
14:07:47 T:140230923368192 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
14:07:47 T:140230923368192 NOTICE: [service.tvh.manager]: Countdown possibly invisible (fullscreen mode)
14:07:47 T:140230923368192 NOTICE: [service.tvh.manager]: Showing additional notification
14:07:47 T:140230774478592 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 284
14:07:47 T:140230774478592 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
14:07:47 T:140230774478592 NOTICE: [service.tvh.manager]: Poweroff command received
14:07:47 T:140230774478592 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
14:07:47 T:140230774478592 NOTICE: [service.tvh.manager]: Countdown possibly invisible (fullscreen mode)
14:07:47 T:140230774478592 NOTICE: [service.tvh.manager]: Showing additional notification
14:07:47 T:140230602622720 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 515
14:07:47 T:140230602622720 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
14:07:47 T:140230602622720 NOTICE: [service.tvh.manager]: Poweroff command received
14:07:47 T:140230602622720 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
14:07:47 T:140230602622720 NOTICE: [service.tvh.manager]: Countdown possibly invisible (fullscreen mode)
14:07:47 T:140230602622720 NOTICE: [service.tvh.manager]: Showing additional notification
14:07:58 T:140230923368192 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 11.11.15 20:47
14:08:03 T:140230923368192 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
14:08:03 T:140230923368192 NOTICE: [service.tvh.manager]: Service with id 377 (V.0.3.2 on Kurosh-HTPC) kicks off
14:08:03 T:140230774478592 NOTICE: [service.tvh.manager]: Instruct the system to shut down using Kodi/XBMC method
14:08:03 T:140230774478592 NOTICE: [service.tvh.manager]: Service with id 284 (V.0.3.2 on Kurosh-HTPC) kicks off
14:08:03 T:140230602622720 NOTICE: [service.tvh.manager]: Service with id 515 (V.0.3.2 on Kurosh-HTPC) kicks off

Kurosh-HTPC:~/.kodi/addons/service.tvh.manager/resources/lib #


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-10

P.S. I have replaced the photo of the BIOS manual in my previous post #121 with a snapshot of my actual live BIOS config. Hopefully it's now correct?


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2015-11-10

The last lines of the log shows that You use the xbmc/kodi method. That ist happended from the method what you've defined in method for system wide poweroff (e.g. suspend, poweroff etc). Switch this to 'OS' (addon settings).


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-10

Sorry I don't understand this sentence:

"That ist happended from the method what you've defined in method for system wide poweroff (e.g. suspend, poweroff etc)."

I have changed it to "Operating System" in the addon (Shutdown performed by...)

Now it still says the usual "shutting down in 5,4,3,2,1... and still says the expected time it'll wake up e.g. "20:35 Recorded File" but then this time nothing happens from here.... it DOESN'T suspend? It just stays on the main menu screen.

Kurosh-HTPC:~ # more ~/.kodi/temp/kodi.old.log | grep service.tvh.manager
20:18:33 T:140502909302528 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 341
20:18:33 T:140502909302528 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:18:33 T:140502909302528 NOTICE: [service.tvh.manager]: Service with id 341 finished
20:18:33 T:140502909302528 NOTICE: [service.tvh.manager]: Service with id 341 (V.0.3.2 on Kurosh-HTPC) kicks off
20:19:23 T:140500844078848 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 735
20:19:27 T:140500813141760 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 980
20:19:30 T:140500719888128 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 684
20:19:32 T:140500844078848 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:19:32 T:140500844078848 NOTICE: [service.tvh.manager]: Poweroff command received
20:19:32 T:140500719888128 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:19:32 T:140500719888128 NOTICE: [service.tvh.manager]: Poweroff command received
20:19:32 T:140500813141760 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:19:32 T:140500813141760 NOTICE: [service.tvh.manager]: Poweroff command received
20:19:36 T:140500719888128 NOTICE: [service.tvh.manager]: User activty detected
20:19:36 T:140500719888128 NOTICE: [service.tvh.manager]: Service with id 684 (V.0.3.2 on Kurosh-HTPC) kicks off
20:19:37 T:140500844078848 NOTICE: [service.tvh.manager]: User activty detected
20:19:37 T:140500844078848 NOTICE: [service.tvh.manager]: Service with id 735 (V.0.3.2 on Kurosh-HTPC) kicks off
20:19:37 T:140500813141760 NOTICE: [service.tvh.manager]: User activty detected
20:19:37 T:140500813141760 NOTICE: [service.tvh.manager]: Service with id 980 (V.0.3.2 on Kurosh-HTPC) kicks off
20:21:08 T:140500813141760 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 636
20:21:08 T:140500813141760 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:21:08 T:140500813141760 NOTICE: [service.tvh.manager]: Poweroff command received
20:21:08 T:140500813141760 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
20:21:14 T:140500813141760 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 10.11.15 20:33
20:21:20 T:140500813141760 NOTICE: [service.tvh.manager]: Instruct the system to shut down using OS method
20:21:20 T:140500813141760 NOTICE: [service.tvh.manager]: Service with id 636 (V.0.3.2 on Kurosh-HTPC) kicks off
20:21:43 T:140501382584064 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 1023
20:21:43 T:140501382584064 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:21:43 T:140501382584064 NOTICE: [service.tvh.manager]: Poweroff command received
20:21:43 T:140501382584064 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
20:21:50 T:140501382584064 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 10.11.15 20:32
20:21:55 T:140501382584064 NOTICE: [service.tvh.manager]: Instruct the system to shut down using OS method
20:21:55 T:140501382584064 NOTICE: [service.tvh.manager]: Service with id 1023 (V.0.3.2 on Kurosh-HTPC) kicks off
20:24:14 T:140501164472064 NOTICE: [service.tvh.manager]: Settings loaded, starting service with id 61
20:24:14 T:140501164472064 NOTICE: [service.tvh.manager]: Connection to http://127.0.0.1 established
20:24:14 T:140501164472064 NOTICE: [service.tvh.manager]: Poweroff command received
20:24:14 T:140501164472064 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
20:24:20 T:140501164472064 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 10.11.15 20:33
20:24:25 T:140501164472064 NOTICE: [service.tvh.manager]: Instruct the system to shut down using OS method
20:24:25 T:140501164472064 NOTICE: [service.tvh.manager]: Service with id 61 (V.0.3.2 on Kurosh-HTPC) kicks off


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-10

Not sure if this is relevant but from doing the following command:

tail -f /storage/.kodi/temp/kodi.log

using the Kodi/XBMC method for shutdown the following lines appear.

20:40:06 T:139697451366272 NOTICE: OnSleep: Running sleep jobs
20:40:06 T:139697451366272 NOTICE: OnSleep: Stopping lirc

As you can see with the previously log, with the "Operating System" method it does not produce these lines.


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2015-11-11

Code:
20:24:14 T:140501164472064 NOTICE: [service.tvh.manager]: Display countdown dialog for 5 secs
20:24:20 T:140501164472064 NOTICE: [service.tvh.manager]: Wakeup for Recording by ACPI at 10.11.15 20:33
20:24:25 T:140501164472064 NOTICE: [service.tvh.manager]: Instruct the system to shut down using OS method
And this is the point where the shutdown.sh is called from the addon but does not execute properly. I don't know why. In 'normal' OSes this script must be executed with root privileges. This is what visudo does. Can you do a shutdown from console like

Code:
shutdown -h now
if yes, start the shutdown.sh separatly with the needed parameters. Look for a script that determines a timestamp that is e.g 10 minutes in future (http://www.unixtimestamp.com/index.php) and start the script, e.g.

Code:
~/.kodi/addons/service.tvh.manager/resources/lib/shutdown.sh ACPI 1447228800 1 # the second parameter ist the timestamp in future.
and look if the script shutdown and wake up the htpc properly. Btw.

Code:
20:40:06 T:139697451366272 NOTICE: OnSleep: Running sleep jobs
20:40:06 T:139697451366272 NOTICE: OnSleep: Stopping lirc

doesn't matter.


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-11

Hi,

shutdown -h now (completely shutdown the OE 6.0 system)

and

~/.kodi/addons/service.tvh.manager/resources/lib/shutdown.sh ACPI 1447264920 (set the wake timer and when I put the computer in suspend using the kodi/xbmc method in the addon it woke up as expected.

In summary, both worked.


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2015-11-12

You use OpenELEC, please edit the .kodi/addons/service.tvh.manager/default.py
Code:
nano .kodi/addons/service.tvh.manager/default.py
and change line #39 from
Code:
PLATFORM_OE = True if ('OPENELEC' in ', '.join(platform.uname()).upper()) else False
to
Code:
PLATFORM_OE = True # if ('OPENELEC' in ', '.join(platform.uname()).upper()) else False
This set PLATFORM_OE always to True


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - kurosh - 2015-11-12

Thanks, I guess that is what was suggested on the german kodi forum?

I will edit that when I get home later. I have a question though, should I switch the shutdown method to OS or KODI/XBMC in the addon?


RE: [RELEASE]Plugin for Timer- and Powermanagement in XBMC/Kodi and TVHeadend - _BJ1 - 2015-11-12

In some circumstances the OS method is safer for me because this method use the 'shutdown -h now' command from shutdown.sh The Kodi/XBMC method use the shutdown mechanism provided by Kodi itself. Try yourself out.