Launch addon onWake or let addon know of wake up
#1
Question 
hi!

i'd like to add a functionality to my addon "Advanced Wake-On-LAN":
to send a WOL-signal to a remote host after the XBMC-host has itself resumed from sleep.

is there any way to either launch the addon after wakeup, or to let the addon (which is already running as a service) know, that XBMC has just come up from sleep?

best wishes
mandark
Reply
#2
Check Xbox.getGlobalIdleTime periodically and take action if it's less than the previous check
Reply
#3
(2012-10-11, 06:17)Bstrdsmkr Wrote: Check Xbox.getGlobalIdleTime periodically and take action if it's less than the previous check
thanks for the reply, Bstrdsmkr. but this solution checks for the idle-time, which means it gets reset at every user input. i would need a solution, that lets me determine, if XBMC has come out from sleep/suspend/standby.

but i've already found a solution (thanks to user "jandias" for this! Smile):

Code:
    previousTime = time.time()
    while (not xbmc.abortRequested):
        if ( time.time()-previousTime > 5):
            print "XBMC has returned from standby"
            previousTime = time.time()
            xbmc.sleep(1000)
        else:
            previousTime = time.time()
            xbmc.sleep(1000)
Reply
#4
Took me a while to understand your approach Smile You look for 5-second discontinuities in the clock to indicate that the system was asleep for those 5+ seconds
Reply
#5
I think you also need to set previous time even if the difference is greater than five seconds, otherwise you end up with the if statement running every second. Once it's positive, it stays positive.
Reply
#6
(2012-10-14, 07:52)Bstrdsmkr Wrote: I think you also need to set previous time even if the difference is greater than five seconds, otherwise you end up with the if statement running every second. Once it's positive, it stays positive.
yes, you're right. Smile i actually have that in my code, but i must have deleted it after pasting it here. i've edited the upper post.

Reply

Logout Mark Read Team Forum Stats Members Help
Launch addon onWake or let addon know of wake up0