Wake_on_lan (wol) Switch

With me travelling a lot for work and installations, I sometimes need to access my office pc for info. Up to now I relied on my wife to start my PC whenever I needed it. Not being able to keep to office hours it happened a few times that I needed access to my PC late at night or very early in the mornings while she was sleeping, needless to say, the work had to wait.

Digging deeper and deeper into HA, I discovered a standard “wake_on_lan” switch today. Added 3 lines to my configuration.yaml file, “Enabled” my WOL setting in the BIOS and “voilà”…

# Wake Up Jaco_PC
  - platform: wake_on_lan
    name: "your_pc_name"
    mac: "your_pc's_mac_address"

Now I can switch on my PC from anywhere anytime and thought, maybe someone else can use this as well.

5 Likes

Great post, Jaco!

I use it to turn on a PC here at home which runs my Plex server (which is set to sleep at night to save precious battery). Home Assistant automatically wakes it up again in the morning so that Plex is available if the family wants to watch something.

1 Like

The tough part is getting things to turn off.

Once I am done, I just do a normal shutdown. It works for me… Unless our application of this function differs.

I was more looking for it to turn off the PC if I leave the house as part of the shutdown script. But no big deal.

Under correction, I think I did see that. Let me have a look.

What OS do you use?

Windows

I do what they recommend here: https://community.home-assistant.io/t/remote-shutdown-restart-sleep-hibernate-pc/11473

Little freeware program called Airytec Switchoff. It has a little webserver which you can call from Home Assistant to shut down, sleep etc. I use shell commands in Home Assistant and then the curl command in Linux:

shell_command:
  pc_shutdown: 'curl -u User:Password -k http://172.16.16.108:10000/?action=System.Shutdown'
  pc_restart: 'curl -u User:Password -k http://172.16.16.108:10000/?action=System.Restart'
  pc_sleep: 'curl -u User:Password -k http://172.16.16.108:10000/?action=System.Sleep'
  pc_hibernate: 'curl -u User:Password -k http://172.16.16.108:10000/?action=System.Hibernate'

You can then trigger it from an automation like follows:

automation:
- alias: Let ASUS sleep immediately from IOS notification
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: LET_PC_SLEEP
  action:
  - service: shell_command.pc_sleep

EDIT: It works really well with Jaco’s WOL recommendation – if you don’t have Solar or an inverter and you wish to shutdown a Windows PC before loadshedding, and turn it on again afterwards, you can use this :slight_smile:

2 Likes

Came across https://github.com/home-assistant/addons/tree/master/rpc_shutdown this today and thought about your post earlier…

Its to shut down Windows PC’s remotely.

1 Like