Page 1 of 1
Wake up on lan and shutdown
Posted: Monday 08 September 2014 14:53
by Landry
Hello, i love domoticz!
One problem : i have a xbmc computer on a Windows system (ip :192.168.5.2)
Question one: i would like to create a on/off switch on on fonction it make a Wake up on lan (witch could be done with the Wake up on lan fonction of domoticz in hardware) but i don't know how to link the wol fonction on a on/off bouton.
Question two : how to lunch the sutdown command like "net rpc shutdown -I IPADDRESS -U USERNAME%PASSWORDP" on the off fonction witch could shutdown my xbmc computer
Someone could give me the way to follow to make that?
Re: Wake up on lan and shutdown
Posted: Monday 08 September 2014 18:48
by gizmocuz
WOL is done via sending a magic UDP packet.
If you add the mac address of the machine in the WOL (add WOL hardware, next click on it's setup button),
you will automatically get a switch (if not enable new hardware in the settings)
there is no shutdown option, you can configure windows to sleep after 1 hour for example
Re: Wake up on lan and shutdown
Posted: Monday 08 September 2014 21:58
by Raspberry Piet
To shutdown your windows system (with xbmc running)
Make a simple
xbmc_off.sh script
Code: Select all
#!/bin/sh
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"System.Shutdown"}' http://xbmc:[email protected]:8080/jsonrpc
(Or put it in a lua script with an os.execute)
Asuming your
xbmc webserver is running at port 8080 with user xbmc and password xbmc it should shut your windows system down.
(Or you might want to change System.Shutdown to System.Hibernate)
Re: Wake up on lan and shutdown
Posted: Tuesday 09 September 2014 7:25
by Landry
Thx for your Two usefull answer
One question, the wol function make a virtual switch with only one state on.
I want to have a virtual switch with two states on on fonction the wol switch and on off fonction the lua scrit of Raspberry Piet .
Someone know how to make that?
Re: Wake up on lan and shutdown
Posted: Tuesday 09 September 2014 14:33
by Landry
Hello,
I have found the solution :
1) Make wol fonction in Configuration->Hardware
2) Setup the mac computer to wake up and create a switch (it will create a push on switch) name it with an $ before name to hide it
3) take the idx of this hidden switch
4) make a virtual switch
5) Put this line in Action on :
Code: Select all
http://127.0.0.1:8080/json.htm?type=command¶m=switchlight&idx=1&switchcmd=On (put your domoticz address, port and idx)
6) Put this line in Action off :
Code: Select all
http://127.0.0.1:8079/jsonrpc?request=%7B%22jsonrpc%22%3A%222.0%22%2C%22method%22%3A%22System.Shutdown%22%2C%22id%22%3A1%7D
(put your xbmc address and port )
It's work like a charm.
If someone have a way to bypass the hidden swith for the wol fonction and have a direct json command it will be great!
Re: Wake up on lan and shutdown
Posted: Wednesday 01 April 2015 20:08
by Morcegolas
@Landry great work, I was able to put the WOL working using your method, shutting down my Kodi isn't working, don't know why, in the same switch that I put the Action On, I put the action Off like this:
http://10.1.1.5:8080/jsonrpc?request=%7 ... %22%3A1%7D
Using my Kodi IP and http Port, but when I press it nothing happens, can you help me? My Kodi is runing in linux, is Kodibuntu.
EDIT:
Maybe because it needs the username and the password of kodi web interface, anyway solution this out without removing the password?
Thanks.
Re: Wake up on lan and shutdown
Posted: Thursday 21 April 2016 16:14
by nosehook
Is there a way to make the system sleep? I am running a machine on Win 10 and after I shut down using this code, I can no wake it.
I have had a look in the BIOS settings but can not find an option that could resolve this.
Any hints or tips?
Thanks,
Freek
Re: Wake up on lan and shutdown
Posted: Monday 25 April 2016 12:13
by Derik
What bios u use?