[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
mandark Offline
Member
Posts: 79
Joined: Jun 2009
Reputation: 3
Lightbulb  [RELEASE] Advanced Wake On Lan (WOL) Addon - Wake up a remote computer/server Post: #1
The Addon "Advanced Wake On Lan" allows you to wake up a sleeping computer by sending a WOL magic packet using its ethernet MAC address. It displays a notification if and when the computer is available, or an error message, if the computer did not wake up during a configurable timeout.

Feature Overview:
  • send a WOL wakeup-packet via the XBMC-builtin-command "WakeOnLan",
  • tries to verify the success of the wake-up-command by pinging the remote computer,
  • displays on-screen-notifications during verification of wake-up-command (waiting for answer, answer received or error),
  • can be launched manually or configured to autostart with XBMC,
  • can initiate (music- and/or video-) library-updates on successful wakeup when used with autostart
  • can also send wake-up-signal after XBMC itself has come out of standby/suspend/sleep
  • can be provided with another XBMC-command as a parameter, which will then be launched either immediately or not until the remote computer is available (behaviour can be set by a second parameter)
  • can be provided with MAC-address and hostname/IP of remote computer as a script-parameter (instead of using the addon-settings) - this way you can wake multiple remote computers independently with e.g. different favourite-entries.
  • can be configured to send continuous WOL-packets with a configurable delay.
Screenshots:
[Image: screenshot_waiting.jpg]

[Image: screenshot_settings_basic.jpg]

[Image: screenshot_settings_autostart.jpg]

[Image: screenshot_settings_notifications.jpg]

[Image: screenshot_settings_advanced.jpg]

Usage Details:
  • First, enter the addon-settings and configure the MAC-address of the remote-computer (e.g. "50:E5:49:B5:61:34") AND it's hostname or IP-address (by which it can be pinged from the computer running XBMC).
  • PLEASE NOTE: It seems, that the hostup-check via ping only works, when XBMC is run with root- (on Linux) or administrator- (on Windows) -rights. You will get an error message, if this is not the case. As an alternative, you can You can disable the hostup-check via ping in the Addon's "Advanced Settings", and instead set a timespan, after which the addon should assume, that the server has awoken. The actual waking-up should not be affected by this and should also work with non root- or administrator-rights.
  • The Addon can be launched manually from the Programs-section of XBMC (and thus added to your favourites, as home-menu-items, etc.), and can also be configured in the addon-settings to autostart with XBMC, thus waking up your remote computer when XBMC starts. Enabling Autostart also enables some further possibilities like automatically starting library updates after a successful wake-up, or performing a wake-up after XBMC itself has come after standby.
    PLEASE NOTE: If Autostart is enabled, a socket-error can occur, stating that the network is not ready yet. This can be the case, if XBMC starts, when the operating system has not yet initialized the network. In this case, you can set a delay for the WOL-signal in the "Autostart"-section of the Addon-settings.
  • Additionally another command (e.g. activate a specific window) can be handed to the script as a parameter. It then launches that command either immediately or not until the remote computer is available. Behaviour can be set by a second parameter:
    - False: launch immediately (default)
    - True: wait for remote computer

    As an example, you could add the following entry to your favourites.xml:
    Code:
    RunScript("script.advanced.wol",ActivateWindow(MyVideoLibrary),True)
    This would attempt to wake the remote computer configured in the "Advanced Wake On Lan"-Settings, wait until it is awake, and only then launch the XBMC-Video-Library. If the last parameter is set to "False" (or omitted), the script would start the wake-up-process and simultaneously enter the video library without waiting for the remote computer to successfully wake up.

    This feature is especially useful, if you want to launch your remote computer, when entering a specific menu-item in XBMC.
  • You can also pass the Host/IP and MAC-Address of the Remote Computer to the script as the third parameter, and thus bypassing the config in the addon-settings. Example:
    Code:
    RunScript("script.advanced.wol",,,my-server@50:E5:49:B5:61:34)

    This is useful, if you have more then one remote computer you want to wake independently. For example, you can put several such lines in your favourites.xml and wake every remote computer independently from there.
  • In the advanced settings you can also set the addon to continue sending WOL packets with a configurable delay. This is useful, when the remote computer or NAS is kept awake, as long as WOL-packets are received. Normally the continuous WOL-packets will also continue after XBMC has returned from standby/sleep/suspend, but there is an option to turn this behaviour off.
Requirements:
  • at least XBMC version 11.0 Eden
  • This Addon should work on all platforms.
Current Version: v1.2.2

Download:
  • The Addon is available via the official XBMC Addon-Repository (in the Program Add-ons-Section)
  • Alternatively you can also download it as a ZIP-File here
(This post was last modified: 2012-10-24 21:04 by mandark.)
find quote
BORIStheBLADE Offline
Fan
Posts: 638
Joined: Jul 2009
Reputation: 0
Location: California
Post: #2
Nice! I will give it a try when I get a chance.
I have been thinking about how nice it would be for my server to spin up the HD's when I turn on a XBMC box in my house.

- ASUS AT5IONT-I Intel Atom D525
- Kingston KVR1066D3S7/1G
- SILVERSTONE Sugo SG05-B

http://www.streamernation.com/
find quote
mandark Offline
Member
Posts: 79
Joined: Jun 2009
Reputation: 3
Post: #3
the addon is available via the official XBMC-addon-repository now (for XBMC Eden only).
find quote
TheLexus Offline
Junior Member
Posts: 5
Joined: Jan 2012
Reputation: 0
Post: #4
Hi Mandark,

great, i like your plugin and have one request, maybe you have a little time to add it.

I use a self build NAS which wake up using wol and stays awake until no wol packet arrive in a time period.

In the past i used a python skript on my xbmc to continues sending wol packets. Could you add such a continues send feature with a configurable delay between the packets to your plugin?

Much thanks!
TL
(This post was last modified: 2012-02-03 11:34 by TheLexus.)
find quote
mandark Offline
Member
Posts: 79
Joined: Jun 2009
Reputation: 3
Post: #5
hi TL!

i may be wrong, but i think it's a bit unusual to keep a server or NAS awake by continuously sending WOL-packets. the purpose of WOL-packets is to wake up devices, not to keep them awake.

is this an official feature of you NAS?

most solutions i know of solve this problem the other way round. once the server is awake, a service on the server itself is continously looking, if predefined clients are still present, and goes back to sleep, if there are none. examples would be the lightsout-addon of Windows Home Server or the tool SmartPower for Windows. i'm sure tools with similar functionality exist for other platforms (linux, mac, etc.). maybe you could change your NAS-setup to implement such a solution?
find quote
TheLexus Offline
Junior Member
Posts: 5
Joined: Jan 2012
Reputation: 0
Post: #6
Hi,

yes of course. The purpose is to wake up. But the other way around is not that simple to implement if you run many services like nfs/samba/http server. Each of them must be checked. Its possible but it is far more easier to track some pakets like wol and keep the server running.

As far as i know buffalo uses this technique and i catched it up on my own software used to manage my nas (its home build running Ubuntu Server).

Would be nice if you consider to implement that feature, even if its not useful for the masses. If you have no time i can take a look and make a patch.

Bye
TL
find quote
TheLexus Offline
Junior Member
Posts: 5
Joined: Jan 2012
Reputation: 0
Post: #7
Ok. Here is a small patch, maybe you want to add it to the main source:

Code:
diff -rupN script.advanced.wol/autostart.py script.advanced.mod.wol/autostart.py
--- script.advanced.wol/autostart.py    2012-01-24 11:54:26.000000000 +0100
+++ script.advanced.mod.wol/autostart.py    2012-02-03 12:41:22.332879188 +0100
@@ -11,4 +11,18 @@ autostart = settings.getSetting("autosta
performWakeup = False

if (autostart == "true"):
-  import default
\ Kein Zeilenumbruch am Dateiende.
+  import default
+
+continuesSending = settings.getSetting("continuesSending")
+
+if (continuesSending == "true"):
+  mac_address = settings.getSetting("macaddress")
+  delay = int(settings.getSetting("delay"))
+  count = 0
+  while (not xbmc.abortRequested):
+    xbmc.sleep(1000)
+    if (count == delay):
+      xbmc.executebuiltin('XBMC.WakeOnLan("'+mac_address+'")')      
+      count = 0
+    else:
+      count+=1
diff -rupN script.advanced.wol/resources/language/English/strings.xml script.advanced.mod.wol/resources/language/English/strings.xml
--- script.advanced.wol/resources/language/English/strings.xml    2012-01-24 11:54:26.000000000 +0100
+++ script.advanced.mod.wol/resources/language/English/strings.xml    2012-02-03 11:56:02.092925800 +0100
@@ -4,6 +4,8 @@
     <string id="50001">IP-address or hostname</string>
     <string id="50002">Timeout (in seconds)</string>
     <string id="50003">Wake on XBMC-start</string>
+    <string id="50004">Continues sending</string>
+    <string id="50005">Delay (in seconds)</string>
     <string id="60000">Waking up %hostorip%...</string>
     <string id="60001">Waiting for %hostorip% to wake up...</string>
     <string id="60002">%timecount% of %timeout% seconds</string>
diff -rupN script.advanced.wol/resources/language/German/strings.xml script.advanced.mod.wol/resources/language/German/strings.xml
--- script.advanced.wol/resources/language/German/strings.xml    2012-01-24 11:54:26.000000000 +0100
+++ script.advanced.mod.wol/resources/language/German/strings.xml    2012-02-03 11:55:50.680925996 +0100
@@ -4,6 +4,8 @@
     <string id="50001">IP-Adresse oder Host-Name</string>
     <string id="50002">Timeout (Sekunden)</string>
     <string id="50003">Mit XBMC-Start aufwecken</string>
+    <string id="50004">Kontinuierliches Senden</string>
+    <string id="50005">Abstand (Sekunden)</string>
     <string id="60000">%hostorip% wird geweckt...</string>
     <string id="60001">Warte auf Aufwachen von %hostorip%...</string>
     <string id="60002">%timecount% von %timeout% Sekunden</string>
diff -rupN script.advanced.wol/resources/settings.xml script.advanced.mod.wol/resources/settings.xml
--- script.advanced.wol/resources/settings.xml    2012-01-24 11:54:26.000000000 +0100
+++ script.advanced.mod.wol/resources/settings.xml    2012-02-03 11:53:50.896928052 +0100
@@ -4,4 +4,6 @@
     <setting id="hostorip" type="text" label="50001" default="my-server" />
     <setting id="timeout" type="labelenum" label="50002" values="10|20|30|40|50|60|120" default="30" />
     <setting id="autostart" type="bool" label="50003"  default="false" />
+    <setting id="continuesSending" type="bool" label="50004"  default="false" />
+    <setting id="delay" type="labelenum" label="50005" values="10|20|30|40|50|60|120" default="30" />
</settings>
find quote
UDM1 Offline
Junior Member
Posts: 3
Joined: Feb 2012
Reputation: 0
Post: #8
Hi Mandark,

first I want to thank you for this great Addon! I have only a small error and it would be very nice if you could help me to fix this.

My Hardware setup:
- E45M1-I DELUXE (AMD FUSION)
- 60GB SSD
- 4GB RAM

My Software Setup:
- OpenELEC_BUZZ-Fusion.x86_64-devel-20120131182836-r9772.tar.bz2
- It's a Fusion build based on the beta of eden

What I want:
I want that the WHS boots up when I start the htpc in my living room and shut down when I suspend/shutdown the htpc.

The problem:
I have an old WHS (Lenovo Idea Center D400) with Lights out etc...
In generally the addon works great and it does a great job. Everything works great...

...but when I start the HTPC I got first the normal Popup in my xbmc for waking up the WHS and directly after that I got an separate popup which said: script-fehler!: autostart.py

So my question is:
Where in the system can i find the autostart.py and have you any logs enabled so that i can deliver you furter information to get this?

Thanks in advance


Edit1:
Sorry i forgot to Post my settings. My settings Look exactly like yours on your Screenshot.
Mac, Hostname, 30, dot
(This post was last modified: 2012-02-04 11:46 by UDM1.)
find quote
bassic Offline
Junior Member
Posts: 27
Joined: Nov 2011
Reputation: 0
Post: #9
I have the advanced wol addon on an appletv2 and a windows 7 box. Very handy thing.

On the apple it wakes up my synology nas as expected. On windows it works fine too but it gives a socket error message even tho it worked. It says an attempt was made to access a socket in a way forbidden.

It would also be nice if the settings page had the option of running the addon silently. No need for any messages once it's working ok.
find quote
mandark Offline
Member
Posts: 79
Joined: Jun 2009
Reputation: 3
Post: #10
i'm glad you guys find this addon useful! Smile

TheLexus Wrote:Ok. Here is a small patch, maybe you want to add it to the main source:
[..]
very cool, thanks! i'll definitely add that feature to the main source.

UDM1 Wrote:...but when I start the HTPC I got first the normal Popup in my xbmc for waking up the WHS and directly after that I got an separate popup which said: script-fehler!: autostart.py

So my question is:
Where in the system can i find the autostart.py and have you any logs enabled so that i can deliver you furter information to get this?
a script-error should normally not happen. that means there is a bug somewhere. the error should show up in the file "xbmc.log", which should be in your XBMC-user folder. could you please post the error-entries, that show up in there when the error happens?

bassic Wrote:It would also be nice if the settings page had the option of running the addon silently. No need for any messages once it's working ok.
that's a good idea. i'll definitely implement this in the next version. i'll make two options for this:

[o] enable notifications
[o] enable verification-notifications

this way you can disable notifications completely or just the wake-up-verification-notifications.

bassic Wrote:On windows it works fine too but it gives a socket error message even tho it worked. It says an attempt was made to access a socket in a way forbidden.
this means, that the verification of the wake-up-process can not send ping-requests to the remote computer to determine, if it has awoken correctly. i think this only works, if the user, under which XBMC is run has administrative rights in windows (or root-rights in linux respectively). are you running XBMC with a standard-user or an administrative-user?

if you don't want to or can't run XBMC with administrative rights, than i'm afraid you can't use the verification-feature of this addon. but after i have implemented the disabling of notifications, you can completely disable that feature, and at least you won't get that error anymore.
find quote
Post Reply