Wake up after standy
#1
Hello,
maybe someone can hep me. I try to find a way to wake my XBMCbuntu-ZBOX ID41 from sleep.
I use TVheadend on XBMC Frodo and the system supends correctely. I can wake it with my Logitech Harmony which sends signals to a connected FLIRC. Until now I found no way to resume from sleep for a planned recording. I have read many posts and tried several scripts - without success.
In the XBMC Live-TV Configuration menu - Power Saving - I enabled the option to wake up the machine.
Meanwhile I am completely confused what I have to enter in the section "Setup wakeup command (CMD timestamp)".
Do I have to put several other scripts to any directories and do I have to enter anything to the TVHeadend webinterface in the Post-processor command- section ?

Thank you for helping me !
Reply
#2
Are you using openelec? I've been using this add on with openelec to prevent shutdown during recordings and wake for recordings

http://openelec.tv/forum/128-addons/5747...end/unread
Reply
#3
(2013-02-07, 00:15)teeedubb Wrote: Are you using openelec? I've been using this add on with openelec to prevent shutdown during recordings and wake for recordings

http://openelec.tv/forum/128-addons/5747...end/unread

No, my machine runs on XBMCbuntu Frodo 12,10
Reply
#4
Is there anybody out there who can help me ?
Reply
#5
You can try this:

Create a file setwakeup.sh in /usr/bin:

sudo nano /usr/bin/setwakeup.sh

Code:
#!/bin/sh
#$1 is the first argument to the script. It is the time in seconds since 1970
#this is defined in mythtv-setup with the time_t argument

echo 0 > /sys/class/rtc/rtc0/wakealarm      #this clears your alarm.
echo $1 > /sys/class/rtc/rtc0/wakealarm     #this writes your alarm

Make sure it is executable:

sudo chmod +x /usr/bin/setwakeup.sh

No you have to add your user or group to enable XBMC executing sudo elevation on the command.

sudo visudo

Add the following to the end of the file:

Code:
%xbmc ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend

Replace %xbmc by the group of your user, or just use xbmc without % for the user only. If xbmc is the default user for XBMCBuntu (I don't know), the line would be:

Code:
xbmc ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend

Now in the XBMC configuration, go to Settings, TV, Energy and fill in the wake up command

sudo setwakeup.sh

Now when XBMC suspends, it will call sudo setwakeup.sh *timestamp* and it will always log an error in xbmc.log about a -1 exit status. Ignore that.
You can check if the correct time is written using

cat /sys/class/rtc/rtc0/wakealarm

You will get a timestamp there and run it through this website for a human readable time:
http://www.epochconverter.com/

Let me know if this works.
Reply
#6
@Frank-NL - thank you for your answer.
I followed your instruction but I 'm afraid it doesn't work for me.

In two points I'm not sure:

Quote:Replace %xbmc by the group of your user, or just use xbmc without % for the user only.
I used the user "bernd" - thats the user I take for loggin in to ssh and even with "xbmc" and "%xbmc" I have nor success.


Quote:cat /sys/class/rtc/rtc0/wakealarm
returns no value....
Reply
#7
today I tried everything without sucess. Any help ?
Reply
#8
This is what I use:

https://www.lonelycoder.com/redmine/proj...iki/Wakeup

Make sure you have wake alarms enabled in your BIOS.

You make the scripts executable

You change the username in the script.

I dont bother with the shutdown suspend after recording and did not change any of the settings within xbmc power setting, just left it as suspend after x minutes of inactivity, all works.
Reply
#9
Hi and thank you. I have seen this before and I´ll try these scripts this evening.

What I don´t understand is

Quote:#!/bin/sh

# This script uses curl. Install curl using the following command from your terminal apt-get install curl
# This script will restart lirc drivers, Lirc, and XBMC's lirc interperater upon resume.

case "$1" in
suspend|hibernate)
service xbmc-live stop
/etc/init.d/tvheadend stop
/etc/init.d/lirc stop
rmmod mantis
rmmod ivtv
rmmod nvidia
;;
resume|thaw)
modprobe nvidia
modprobe mantis
modprobe ivtv

sleep 1
/etc/init.d/lirc start
/etc/init.d/tvheadend start
#remove the comment if the computer automatically sleeps after resume
#irw & sleep 1; killall irw
sleep 2
service xbmc-live start
;;
esac

Do I have to change anything there ?
Reply
#10
Basically the command unloads modules/drivers? before suspend and then reloads them on wake that may cause issues with suspend and resume, as you can suspend resume already with no issues you can probably remove all of the lines you have highlighted.

Actually that script is quite old and needs to be amended , you might not actually even need it here is mine:
#!/bin/sh

# This script uses curl. Install curl using the following command from your terminal apt-get install curl
# This script will restart lirc drivers, Lirc, and XBMC's lirc interperater upon resume.

case "$1" in
suspend|hibernate)
stop tvheadend
;;
resume|thaw)
start tvheadend
;;
esac

The only things that seems to prevent my system from suspending properly is tvheadend itself, hence the above. The way tvheadend starts and stops has changed since the original script was written.

Also make sure you put the scripts in the /etc/pm/sleep.d folder and do sudo chmod +x 99_htpc.sh(or whatever you call the script) as mentioned earlier to make sure the script can run.
Reply
#11
That method is much more complex than what I proposed, why not try to get that working so XBMC decides when to suspend and wake up instead of Tvheadend with all those long scripts?
You should not have to unload any module when suspending, especially not the nvidia one, or modules that are not even used on your system hhbernd!

It is working on my HTPC so it must be possible.

Could you try to set the timer manually using this command:

sudo /usr/bin/setwakeup.sh 1361366070

This sets the timer a week from now.

Now after you've don that, do this again:

cat /sys/class/rtc/rtc0/wakealarm

And paste the result here.
Reply
#12
Thank you, bilbonvida
I´ll try your script this evening and keep you informed.

One question regarding the script from Frank-NL
Quote:No you have to add your user or group to enable XBMC executing sudo elevation on the command.

sudo visudo

Add the following to the end of the file:


Code:

%xbmc ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend

Which user do you add in the script ? Is this the same user I take for example for logging into SSH ?

Best regards from Hamburg
Reply
#13
Yes your line would be:

bernd ALL = NOPASSWD: /usr/bin/setwakeup.sh, /usr/sbin/pm-suspend
Reply
#14
hhbernd , hopefully you will have success with one of the two methods, good luck.

Frank-NL I did not realise xbmc was now capable of setting wake alarms for scheduled recordings natively I had looked at this before myself. Presumably there is an inbuilt script somewhere running the pm-suspend command triggered by the shutdown/suspend timer within xbmc?
Reply
#15
Yes XBMC does it via the TV settings: http://wiki.xbmc.org/index.php?title=PVR...wer_Saving

Here you set the command at Set wakeup command (cmd[timestamp])

You have to create the script yourself, as I explained earlier.

Then you have to make sure XBMC can run the script without sudo password. Hence the sudo visudo instructions.

Works perfectly, all you need is 2 lines of script and setting the sudo permissions.
Reply

Logout Mark Read Team Forum Stats Members Help
Wake up after standy0