Still getting used to and haven’t really figured it out. Can someone please post a sample script for wake on lan as outlined from below. I just can’t get it setup properly, is it supposed to been under Switch or what?
switches.yaml
- platform: wake_on_lan
mac_address: "40:8D:xx:xx:xx:13"
name: "Wake-up Cinema PC"
host: 10.1.1.3
scripts.yaml
wakeup_cinema_pc:
sequence:
- service: switch.turn_on
entity_id: switch.wakeup_cinema_pc
Edit: sorry that is the wake on LAN switch component.
Here is mine:
switches.yaml
- platform: wake_on_lan
mac_address: "6C-62-xx-xx-xx-xx"
name: "Argy PC"
host: "192.168.1.100"
broadcast_address: "192.168.1.255"
Keep in mind that a computer needs to be configured from windows AND BIOS in order to be able to allow the so called “magic packets” to wake up.
That’s the WoL switch component. @johnsnow is interested in the WoL component. I made the same mistake.
yes exactly, just using the non switch commands. If i wanted to use the switches.yaml file do i need to do anything extra or just create the yaml file and just add my WOL devices?
Edit
was able to create the switch.yaml file and its loading, I wanted to use the non switch WOL command as right now i have my lights and computer devices under the same box on the web interface.
The component or the switch work the same. You have to keep in mind what I said in my previous post:
You need to configure your devices to accept magic packets. Some newer computers are on by default. Others need some tweaking.
I am now setting up the component, but I am not home. I will edit this post once I have it tested and I will send you my sample script.
edit: Well, it worked at once. I wasnt expecting that to be honest.
Here you go:
scripts.yaml
'1538381217121':
alias: New Script
sequence:
- data:
mac: xx-xx-xx-xx-xx-xx
service: wake_on_lan.send_magic_packet
Im after some help also to wake up a server I have running on my LAN, wake on lan is working from other devices but I cant figure out how to get hass to wake the server.
I am very new to hass.
Where do I enable Wake on Lan? do I add something to the config.yaml file?
Thanks
-
check the server NIC properties to ensure WoL is enabled (power management tab).
-
set up this component:
Hi Tom thanks, I have managed to enable a switch that works and turns my server on! yay this has taken me ages to work out.
What is the difference between a switch and a script? I have tried doing some reading up on it but its a little vague to me still.
Is a script like a button rather than a switch, because if the switch is on will it keep sending the packet to turn on the server?
What I am trying to do is for HASS to turn on my server automatically every day at 8am, so my thought is to enable a script? and then have that script run everyday at 8am.
Let me know if Im off the mark here and going about it all wrong.
Thanks
HA gets feedback from the switch to show the state of your server (the toggle switch will be on when your server is on). If you use the script you won’t get this.
Hi Tom,
this feature stopped working for me after recent updates and I don’t get the pc status anymore. is it me only?
Unfortunately yes it looks like it is just you. My WoL switch for my HTPC is still working.
OK, let me troubleshoot then,
I have this as a switch.yaml file:
- platform: wake_on_lan name: pc mac_address: "AA-BB-CC-DD-EE-FF" host: 192.168.0.xx
and in configuration file I have this:
`
wake_on_lan:
am I doing anything wrong?
My switch config is the same but I dont have this:
Have you looked at the power properties of the LAN card of the device you are trying to wake?
Maybe something changed when there was a driver update.
funny enough it was my norton 360 which was blocking it by its smart firewall
Do you know how to use this to turn a computer off? I have mine set up to turn the computer on with a switch and I thought I could turn the switch off to shut down the computer but when I click it off it goes to the off position for a couple seconds then back to the on position. There’s a Linux turn_off example here but I’m on a PC.
First of all, you MUST have a password for your account on your windows pc. I havent found a way without a pass, so if you do, please let me know.
The command for turning off a pc remotely from a linux machine is this:
net rpc shutdown -I ipofthecomputer -U usernameoftheaccount%password
Create a shell command with the above command and then add the shell to your WOL switch:
- platform: wake_on_lan
mac_address: "yourmac"
name: "Argy PC"
host: "yourip"
broadcast_address: "192.168.1.255"
turn_off:
service: shell_command.turn_off_argypc
Now, this should work…
If you have trouble turning off the pc you should take a look at this:
Thanks. Can you give me an example of the correct shell command? I put
shell_command:
net rpc shutdown -I **ipofthecomputer** -U **usernameoftheaccount** % **password**
in my config (putting in my info of course) but it isn’t valid. I tried
shell_command:
wake_on_lan: net rpc shutdown -I **ipofthecomputer** -U **usernameoftheaccount** % **password**
and that didn’t work either.
Sure, here you go:
shell_command:
turn_off_argypc: 'net rpc shutdown -I computerip -U user%pass'
You have to quote the command.
I suggest you ssh into your system and try the command from there, so if any error comes up, you can see whats wrong.
shell_command:
turn_off_argypc: 'net rpc shutdown -I computerip -U user%pass'
This is for linux PC right. What is the command i can use to turn off a windows PC?