Wake up on lan and shutdown

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
Landry
Posts: 8
Joined: Monday 16 June 2014 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Wake up on lan and shutdown

Post 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?
User avatar
gizmocuz
Posts: 2484
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Wake up on lan and shutdown

Post 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
Quality outlives Quantity!
Raspberry Piet
Posts: 158
Joined: Saturday 11 January 2014 16:21
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: NL
Contact:

Re: Wake up on lan and shutdown

Post 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)
Landry
Posts: 8
Joined: Monday 16 June 2014 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wake up on lan and shutdown

Post 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?
Landry
Posts: 8
Joined: Monday 16 June 2014 13:29
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wake up on lan and shutdown

Post 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&param=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!
Morcegolas
Posts: 24
Joined: Wednesday 01 October 2014 12:31
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Wake up on lan and shutdown

Post 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.
nosehook
Posts: 49
Joined: Thursday 31 March 2016 20:49
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Netherlands
Contact:

Re: Wake up on lan and shutdown

Post 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
Pi3 Domoticz | RFXcom 433E | KAKU/COCO |Harmony Hub | Samsung TV | HS100 | HS110| HUE | Tradfri | Tado| Xiaomi |sensors | scripts| Pi3 Node Red | Pi2 SDS_011 + MH-Z19B | PiAware (zero) | Pi2 breadboard with Node red and Domoticz
Derik
Posts: 1602
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: Wake up on lan and shutdown

Post by Derik »

What bios u use?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest