[RELEASE] Advanced Wake On Lan (WOL) Addon - Wake up a remote computer/server

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Marvel Offline
Senior Member
Posts: 134
Joined: May 2009
Reputation: 0
Location: UK
Post: #46
(2012-06-13 13:31)yunti Wrote:  I use this on the latest version of openelec (eden based) beta 4 and it works well. However although I can get it to wake my server when I power up the openelec box, when the openelec box resumes from sleep it doesn't send a WOL packet to the server. Is there a way to do this?

I'm in the same boat as yunti. Is there anyway we could achieve this ?

Cheers

Asrock ION 330HT & 32GB SSD | OpenELEC ION x64 Eden | Confluence Mod | Logitech Harmony One
find quote
jandias Offline
Junior Member
Posts: 3
Joined: Sep 2009
Reputation: 0
Post: #47
Probably this is not how I should do it, but here it is anyway. It can be useful to someone as it was to me.

When in continuous WOL "mode", I needed a way to stop this script (besides monitoring xbmc.abortRequested), as when I come from suspend/hibernate mode, I don't need the WOL to continue (aka script continuing running). So here is the code I changed:

Code:
#at beginning of file, along with other existing imports
import time

#near the end
        previousTime = time.time()
        count = 0
        while  (not xbmc.abortRequested and (time.time()-previousTime < 5)):
            previousTime = time.time()
            if (count == continuousWolDelay):
                xbmc.executebuiltin('XBMC.WakeOnLan("'+macAddress+'")')
                print 'WakeOnLan signal sent to MAC-Address '+macAddress
                count = 0
            else:
                count+=1
            xbmc.sleep(1000)
    
    print 'script.advanced.wol closing'
    return

It seems to me the author is no longer around, but if you are: thank you for this AddOn.
(This post was last modified: 2012-09-15 19:57 by jandias.)
find quote
tenzion Offline
Junior Member
Posts: 37
Joined: Sep 2011
Reputation: 0
Location: Denmark
Post: #48
Indeed it seems the author is no longer around, but I will post my question anyway...

Has anyone tried (is it possible at all?) to activate a plugin with this AWOL script?

I have the video plugin "EyeTV Parser" installed on my XBMC. I am using Aeon Nox 3.6.1 and I have added a favourite on the home screen that activates the AWOL script and in turn should activate the EyeTV Parser video plugin. I am using an openelec build if that has any relevance.

Here's the code from favourites.xml
Code:
<favourite name="Advanced Wake On Lan">RunScript(&quot;script.advanced.wol&quot;,ActivateWindow(10025,plugin://plugin.video.eyetv.parser),True)</favourite>

But it doesn't work. The AWOL script part works as my remote host is woken up from sleep, but nothing else happens.

I have tried several solutions with the plugin part, but nothing works.
Is it the python script that doesn't support activating plugins? I am total noob with regards to python.
find quote
mandark Offline
Member
Posts: 90
Joined: Jun 2009
Reputation: 3
Post: #49
hi everyone!

i'm still around - although not very regularily, sorry! i'm also happy, you guys find my addon useful. Blush

i'll try to address some of the last issues:

(2012-10-08 08:45)tenzion Wrote:  I have the video plugin "EyeTV Parser" installed on my XBMC. I am using Aeon Nox 3.6.1 and I have added a favourite on the home screen that activates the AWOL script and in turn should activate the EyeTV Parser video plugin. I am using an openelec build if that has any relevance.

Here's the code from favourites.xml
Code:
<favourite name="Advanced Wake On Lan">RunScript(&quot;script.advanced.wol&quot;,ActivateWindow(10025,plugin://plugin.video.eyetv.parser),True)</favourite>

But it doesn't work. The AWOL script part works as my remote host is woken up from sleep, but nothing else happens.

my guess is, that you have "Enable hostup-check and notifications" disabled in AWOLs addon-settings. to further explain: you've set the last parameter of your favourite-entry to "True", which means AWOL sends the wakeup-signal, is then supposed to check and wait for the remote host to wake up, and launch the command (the "EyeTV Parser") plugin only after a successful wakeup was registered. but if this check is disabled in the settings, it will basically wait forever and never launch the plugin. Wink

as a solution you could either set the last parameter of your favourites-entry to "False". this would send the WOL-signal and immediately launch the command after that - not minding, if and when the remote host actually wakes up. this makes sense e.g. with the movie library, because i can immediately start browsing the library, which also works, while the remote host is not fully awake yet.

however - other actions or plugins require the remote host to be awake, when they are launched. an example would be browsing actual files on the remote host in file-mode. if you need this for using "EyeTV Parser" you have to keep the setting at "True" and check "Enable hostup-check and notifications" in AWOLs setting.

i must admit, that this requirement is not really intuitive, and you may also have a problem, if you find the notifications annoying, but still need the "launch command and wait for remote host". maybe it's better if i change the behaviour to check the hostup-status anyway in this case, even if "Enable hostup-check and notifications" is disabled. i might implement this in the next version.

(2012-09-02 14:24)sw4y Wrote:  Is it possible (maybe with parameters) to wake the server up when xbmc starts ("this is possible"), wait until it's awake and then start searching for new files in the libraries?
this is actually a great idea and it shouldn't be a problem to implement. i'll do that, when i have some time.

@jandias:
i'm glad, you have found a solution to your problem. Smile thanks for providing your solution, maybe i'll include this functionality in a future version.

@Marvel, yunti and others, who want to wake the remote host after XBMC has resumed from standby:
the basic problem is, that i dont't know a way for the plugin to find out, if a resume from standby has taken place. so i cannot implement this feature. there is a workaround however. you could activate "Send continuous WOL packets" in the addon-settings of AWOL. this will send WOL-packets every 30 seconds after activation of the addon (e.g. also when autostarted with XBMC) - and it will continue to do so, if the XBMC-host has come out of standby.
this might not be the most elegant solution, but it should be working without any side-effects. the only problem arises, if you want your remote PC to go into standby while still running XBMC, because XBMC will immediately wake it up again.
i'll also update the documentation regarding this possibility.
find quote
tenzion Offline
Junior Member
Posts: 37
Joined: Sep 2011
Reputation: 0
Location: Denmark
Post: #50
Mandark, thanks for the thorough reply - clarifies a few things.

Yes, I did indeed have "Enable hostup-check and notifications" disabled in the settings, but enabling it did not change anything.
And yes, the "EyeTV Parser" video plugin browses actual files on my remote iMac so yes, it needs to be awake before it would work.

But did you look at the syntax of the code I pasted from favourites.xml? Is it correct?
The "ActivateWindow" refers to 10025 which is "videolibrary" - is this correct when we're dealing with a video plugin? Or is "ActivateWindow" the correct built-in command to use?
find quote
mandark Offline
Member
Posts: 90
Joined: Jun 2009
Reputation: 3
Post: #51
(2012-10-09 09:13)tenzion Wrote:  But did you look at the syntax of the code I pasted from favourites.xml? Is it correct?
The "ActivateWindow" refers to 10025 which is "videolibrary" - is this correct when we're dealing with a video plugin? Or is "ActivateWindow" the correct built-in command to use?
hmm, try the following:

Code:
<favourite name="Advanced Wake On Lan">RunScript(&quot;script.advanced.wol&quot;,ActivateWindow(10025,&quot;plugin://plugin.video.eyetv.parser&quot;),True)</favourite>

what is happening exactly, when you launch the favourite? what notifications pop up? are there any errors? you could also check the "xbmc.log" in your XBMC-user-profile for any errors.
(This post was last modified: 2012-10-09 11:07 by mandark.)
find quote
tenzion Offline
Junior Member
Posts: 37
Joined: Sep 2011
Reputation: 0
Location: Denmark
Post: #52
Unfortunately, the "EyeTV Parser" addon does not support being added as a favourite, thus I can't see any kind of syntax as how to activate it...
I've written to the author of the addon to see if he can be of any assistance.

I will try debugging with xbmc.log later today.

Thanks for your help!
find quote
mandark Offline
Member
Posts: 90
Joined: Jun 2009
Reputation: 3
Post: #53
(2012-10-09 14:30)tenzion Wrote:  Unfortunately, the "EyeTV Parser" addon does not support being added as a favourite,...
this is possible on my installation. just enter the video-library -> video-addons. this should list all installed video-addons. move the cursor over the "EyeTV Parser", bring up the context menu (e.g. via right mouse button), and select "Add to Favourites".
find quote
tenzion Offline
Junior Member
Posts: 37
Joined: Sep 2011
Reputation: 0
Location: Denmark
Post: #54
Which platform are you running XBMC on? And which skin?
I am using the Linux distribution Openelec (http://www.openelec.tv) where the addon EyeTV parser is v2.1.2.

Interesting - is it then the EyeTV parser, openelec or the skin I use (Aeon Nox v3.6.1) that's the problem?

Anyway, I've posted my xbmc.log on Pastebin - http://pastebin.com/2qeb0rfb, if you'd care to take a look...
(This post was last modified: 2012-10-09 19:32 by tenzion.)
find quote
mandark Offline
Member
Posts: 90
Joined: Jun 2009
Reputation: 3
Post: #55
(2012-10-09 19:31)tenzion Wrote:  Anyway, I've posted my xbmc.log on Pastebin - http://pastebin.com/2qeb0rfb, if you'd care to take a look...

thanks for posting your log!

this error is rather helpful in pointing to the problem:

Code:
19:00:54 T:140441375938304  NOTICE: WakeOnLan signal sent to MAC-Address c4:2c:03:12:74:99
19:00:54 T:140441375938304   ERROR: Error Type: <type 'exceptions.ValueError'>
19:00:54 T:140441375938304   ERROR: Error Contents: need more than 1 value to unpack
19:00:54 T:140441375938304   ERROR: Traceback (most recent call last):
                                              File "/storage/.xbmc/addons/script.advanced.wol/default.py", line 114, in <module>
                                                main()
                                              File "/storage/.xbmc/addons/script.advanced.wol/default.py", line 81, in main
                                                except socket.error, (errno, msg):
                                            ValueError: need more than 1 value to unpack

right after successfully sending the WOL-signal, the addon wants to start pinging the remote host, but there seems to be some socket problem that leeds to an error in the AWOL-script.

i think "EyeTV parser" is definitely not the problem here. the problem lies with openelec and AWOL. unfortunately i don't have an openelec-installation to try this myself.

could you please try to simply launch AWOL alone from the programs menu (not via the "EyeTV parser"-favourites-entry) and look in the xbmc.log, if the above error is generated in this case too?

and could you please provide me with some more information:

- what have you entered in the AWOL-setting "IP-address or hostname"?

- what version of openelec are you using exactly?

- are you running the openelec-XBMC with a user with root-rights?
find quote
tenzion Offline
Junior Member
Posts: 37
Joined: Sep 2011
Reputation: 0
Location: Denmark
Post: #56
No problem. Please let me know if there's anything else I can do!

I made a new favourite which just activates AWOL and nothing else. It does not pass on any further commands.
The new xbmc.log is here on pastebin - http://pastebin.com/WnKx6dXq
Even though the error still seems to be there, my iMac is still woken up! (iMac running Mountain Lion v10.8.2).
It seems from what you are writing that this error prevents the AWOL script in continuing?

Quote:- what have you entered in the AWOL-setting "IP-address or hostname"?

- what version of openelec are you using exactly?

- are you running the openelec-XBMC with a user with root-rights?

- I have entered the actual ip address as I am running with static ip addresses in my network. It's of course on the same network as my iMac.
- I am running the latest v2.0 RC1 - the problem was the same with the previous version v2.0 beta 7 though.
- Yes. I believe so. Login to the openelec system requires root access (password can be seen on their website http://www.openelec.tv), there's no other user. In XBMC under "System Info" it says Master User.
find quote
mandark Offline
Member
Posts: 90
Joined: Jun 2009
Reputation: 3
Post: #57
thank you for the additional info, tenzion!

i've now set up a virtual openelec-installation and was able to reproduce the problem. it's rather strange, a function to retreive the protocol-number of the ICMP-protocol, which is used to ping the remote host, did not work on the openelec-installation. the function "socket.getprotobyname("icmp")" returned "protocol not found", which is strange, because it should return the protocol-number. my guess is, that there is a problem with the openelec-linux-distribution.

but anyway: i've made a workaround and everything should be functioning as it should - even on openelec. I'll include some further features during the next days and make a new version of the addon. i'll post the link here, when it is ready. it would be great, if you (and anybody else who likes) would test it. if it's ok then, i'll submit it to the official XBMC addon-repository.
find quote
Skyler Offline
Junior Member
Posts: 10
Joined: Oct 2012
Reputation: 0
Post: #58
That sounds great, I have the same problem on my openelec installation.

If you like I could test the new version as well. Just write a pm. I use a AMD Fusion system with the current RC of openelec V2.
find quote
tenzion Offline
Junior Member
Posts: 37
Joined: Sep 2011
Reputation: 0
Location: Denmark
Post: #59
Thanks mandark. You've been tremendously helpful - and fast!

I will look forward to the next version and of course provide you with feedback when I've tested it.

Just need to make sure the syntax is correct with regards to activating the EyeTV parser plugin...
find quote
mandark Offline
Member
Posts: 90
Joined: Jun 2009
Reputation: 3
Post: #60
i've now finished the new version (v.1.2.0) of "Advanced Wake On Lan". it's available for download here.

here is the changelog:
  • Added futher customizability of notification-settings
  • Added options to perform updates of music- and/or video-libraries after a successful wakeup in autostart mode (thanks to user "sw4y"!)
  • Added option to perform wakeup after XBMC itself has returned from sleep/standby/suspend (thanks to users "Marvel" and "yunti"!)
  • Added option to disable the sending of continuous WOL-packets, when XBMC returns from sleep/standby/suspend (thanks to user "jandias"!)
  • Added option to disable the hostup-check via ping, and instead set a fixed timespan, after that the addon should assume, that the remote host is awake (useful, if hostup-check via ping is not possible)
  • Fixed an error with hostup-check on recent OpenELEC-version (thanks to user "tenzion"!)
  • Restructured settings a bit (you might have to customize your settings again)
it would be great, if anyone who likes to test it, would provide a quick feedback, whether it's working fine and any previous problems are solved. if everything is fine, i'll submit it to the official XBMC addon-repository.

(2012-10-10 19:11)Skyler Wrote:  If you like I could test the new version as well. Just write a pm. I use a AMD Fusion system with the current RC of openelec V2.
that would be great! i've just sent you a PM.

(2012-10-10 19:35)tenzion Wrote:  Just need to make sure the syntax is correct with regards to activating the EyeTV parser plugin...
it should definitely be. it's working with my openelec installation and the new addon-version.
(This post was last modified: 2012-10-13 17:53 by mandark.)
find quote
Post Reply