Auto wake on lan
#1
I have installed the wake on lan plugin to wake my media server when I launch the app from the programs menu in xbmc.

Is there a way to make xmbc wake my media server automatically on launch?

or maybe can I some how make windows 7 send a wol packect to my media server as soon as the HTPC wakes?

This will give it some time to spin up before xbmc tries to connect

Cheers
Amit
Reply
#2
See http://forum.xbmc.org/showthread.php?tid=113049

XBMC has a WakeOnLAN function built in. When you start XBMC it will look or, and run, a Python script called autoexec.py from your userdata folder. You just need to have this script call the WakeOnLAN function. You want something like:

Code:
import xbmc

xbmc.execbuiltin("WakeOnLAN(mac_address)")

See http://wiki.xbmc.org/?title=List_of_Built_In_Functions for more info on the WakeOnLAN function.

JR
Reply
#3
similar to autoexec.py, is there some script that is executed when resuming from standby/hibernation?
Reply
#4
I dont have the file in my userdata folder.

Can I just create a text file matching the above?

Do I need to install python or anything to make it work? I have a virgin Windows 7 build with a virgin stable release of xbmc

I would also like the WOL on wake from hibernate as my htpc normally sleeps straight from xbmc
Reply
#5
I tried creating an autoexex.py file in my userdata file with your code in it and it did nothing.

I dont know if the file is in the correct place, or if I need to install python or something..

so I solved my problem a different way.

I created a windows task that is triggered by a power on or resume from sleep event that runs a cmd line wol utility

Amit
Reply
#6
If you enable debug logging and restart XBMC the log will show if XBMC found your autoexec.py, and if so what happened when XBMC tried to run it.

@Ara1: there is no way to have XBMC run a script, or indeed take any action, after waking from suspend or hibernation.

JR
Reply
#7
Ok did that.

The script is being found but isn't able to run the script
Reply
#8
AmitUK1978 Wrote:Ok did that.

The script is being found but isn't able to run the script

If you pop the log on http://pastebin.com/ I'll have a look.

JR
Reply
#9
I think this is the relevant info from the log

17:11:32 T:3000 M:2941681664 NOTICE: -->Python Interpreter Initialized<--
17:11:32 T:3000 M:2941677568 DEBUG: XBPyThread:Tonguerocess - The source file to load is C:\Users\HTPC\AppData\Roaming\XBMC\userdata\autoexec.py
17:11:32 T:3000 M:2941669376 DEBUG: XBPyThread:Tonguerocess - Setting the Python path to C:\Users\HTPC\AppData\Roaming\XBMC\userdata;C:\Users\HTPC\AppData\Roaming\XBMC\addons\script.module.simplejson\lib;C:\Users\HTPC\AppData\Roaming\XBMC\addons\script.module.beautifulsoup\lib;C:\Program Files (x86)\XBMC\addons\script.module.pil\lib;C:\Users\HTPC\AppData\Roaming\XBMC\addons\script.module.elementtree\lib;C:\Program Files (x86)\XBMC\addons\script.module.pysqlite\lib;special://xbmc/system/python/DLLs;special://xbmc/system/python/Lib;special://xbmcbin/system/python/python24.zip;special://xbmc/system/python\DLLs;special://xbmc/system/python\lib;special://xbmc/system/python\lib\plat-win;special://xbmc/system/python\lib\lib-tk;C:\Program Files (x86)\XBMC
17:11:32 T:3000 M:2941669376 DEBUG: XBPyThread:Tonguerocess - Entering source directory C:\Users\HTPC\AppData\Roaming\XBMC\userdata
17:11:32 T:3000 M:2941534208 INFO: -->Python script returned the following error<--
17:11:32 T:3000 M:2941534208 ERROR: Error Type: exceptions.AttributeError
17:11:32 T:3000 M:2941534208 ERROR: Error Contents: 'module' object has no attribute 'execbuiltin'
17:11:32 T:2176 M:2941493248 DEBUG: CApplication::ExecuteXBMCAction : Translating SetFocus(9000)
17:11:32 T:2176 M:2941493248 DEBUG: CApplication::ExecuteXBMCAction : To SetFocus(9000)
17:11:32 T:1896 M:2941886464 NOTICE: ### TV-Show Next-Aired starting ...
17:11:32 T:1896 M:2941886464 NOTICE: ### author: Ppic, Frost
17:11:32 T:1896 M:2941886464 NOTICE: ### URL: http://code.google.com/p/passion-xbmc/
17:11:32 T:1896 M:2941886464 NOTICE: ### credits: Team Passion-XBMC, http://passion-xbmc.org/
17:11:32 T:1896 M:2941886464 NOTICE: ### date: 17-10-2010
17:11:32 T:1896 M:2941886464 NOTICE: ### version: 2.1.2
17:11:32 T:1896 M:2933370880 NOTICE: {'silent': 'True'}
Reply
#10
Just to add, the content of my autoexec.py file is a cut and paste of the code you pasted above with the correct mac address
Reply
#11
Ah, err, oops, yes. the error is:

ERROR: Error Contents: 'module' object has no attribute 'execbuiltin'

execbuiltin should be executebuiltin. Try:

Code:
import xbmc

xbmc.executebuiltin("WakeOnLan(00:00:00:00:00:00)")

where you replace 00:00:00:00:00:00 with the MAC address.

JR
Reply

Logout Mark Read Team Forum Stats Members Help
Auto wake on lan0