Wake on LAN not doing anything

Hi,

I just installed Home Assistant as a Hyper-V virtual machine and it seems to be working - it found some devices such as my Google Home and Harmony Hub and are controllable. Now I’m trying to get it to switch on one of my PCs using Wake on LAN, but nothing happens. I know WoL is working because I have an app on my phone that can perform the wake up as can my OPNsense firewall.

Is there something extra I need to configure on the VM in order to allow the packet to leave the machine as I suspect that’s where the problem lies. I tested WoL from another VM on the same host and switch, and it works. It’s just Home Assistant that doesn’t.

This is what I added to my configuration.yaml file:

wake_on_lan:

#Wake on LAN - PC
switch:
  - platform: wake_on_lan
    mac: "44:xx:xx:xx:xx:xx"
    name: "PC"
    host: "192.168.1.19"
    broadcast_address: "192.168.255.255"

I also tested using the developer services tool, with wake_on_lan.send_magic_packet and still nothing.

I’ve just checked a WoL configuration I have that is working. There is no broadcast_address: on mine and besides, your’s is probably wrong - it should be 192.168.1.255 if your netmask is 255.255.255.0 or /24 for 192.168.1.19.

This is working and unobfuscated:

switch:
  - platform: wake_on_lan
     name: techtv_left
     mac: "A8:23:FE:EF:50:22"
     host: "10.77.5.143"
     turn_off:
       service: shell_command.turn_off_techtv_left

I have to use SNMP to switch them off, hence the turn_off: script.

1 Like

Thanks. I changed the broadcast address, no change, removed it and it suddenly worked - I restarted between each change. I put it back as I had it originally and it’s working again. As it’s optional I’ve left it out now so it can’t cause any issues later.

I’ve just had a look at the docs again. The default IP broadcast address is 255.255.255.255 so yours would probably work as well. However, WoL is usually for before there is an IP address on the interface even listening, which is why you send the packet to the MAC address. Perhaps the IP version is for a unit in standby with a running IP stack, in which case a unicast would work anyway!

Anyway, you are up and running which is the main thing.

1 Like

Hello all

I am very new to HA and i am building my first automation.

basically I want to wake on lan a pc then wait 7 seconds and the turn on a smart plug

I have copied the above configuration for the wake on lan in my configutation.yaml. now this configuration.yaml looks ‘like this’

wake_on_lan:

switch:

  • platform: wake_on_lan
    name: htpc on
    mac: 10:7B:44:50:33:80
    host: 192.168.1.10

i get a green check mark in the file editor and i save it

i go to configurations and server control and check configuration and i have no errors

i restart HA

I go to configuration and modify my automation

It currently has selected time and has a time set for the trigger

action type: call service

Service : Switch Turn on

I go the the selection box to pick the entity and the wake on lan or htpc on is not shown an an option

what am i missing?

thank you for your help

WOL is not a switch, it is a service

Create a template switch :

  - platform: template
    switches:
      desktop_destiny:
        value_template: "{{ is_state('binary_sensor.desktopdestiny', 'on') }}"
        turn_on:
          - service: wake_on_lan.send_magic_packet
            data:
              mac: 'd4:3d:7e:2e:89:53'
        turn_off:
          - service: mqtt.publish
            data:
              topic: iotlink/workgroup/desktop-destiny/commands/shutdown

Hello

Thank you for your very quick reply. So many different solutions.

Based upon your reply

I created a script called wake on lan. because i read this is the preferred way to control all the scrips in HA

I checked configuration and it was green and restarted HA

in the steps details of the script it shows

Executed: 26 August 2021, 9:17:59
Result:
params:
domain: wake_on_lan
service: send_magic_packet
service_data:
mac: 10:7B:44:50:33:80
target: {}
running_script: false
limit: 10

tried it from the pc and from the mobile app it works

thank you

why some thread call the service wake_on_lan and here it’s called wake_on_lan.send_magic_packet.

What is the difference. Because i would like to start 2 freenas servers with wake on lan automations (one is my main server that needs to be turned on @ 06:30 everyday and the second is my redundant server that gets turned on every saturday at 23:00)

Once again thank you for your quick and early reply have yourself a great day

See for yourself. Go to Developer Tools → Services. wake_on_lan is the domain, with only one service for wake-on-lan : wake_on_lan.send_magic_packet

Thank you

This is the same screen that came up when i built the script and it worked I truly do not these differences I need to learn much more about it.

nevertheless thank you for explaining how to do it

Hello all

sory to show my ignorance .

for the past year everytrhing worked perfectly

during the last 2 weeks i had several issues with my solutions.
a) a server was not reading the disks . I replaced the network card and now the psu failled
b) i tinkerred with my htpc and now am not able to WOL any more.

  1. I reset the network adapters to allow the wol with magic packet
  2. i ensured that the power setting were properly configure. (before it was shutting down the pc)
  3. the bios is properly configured

now the above solution no longer works (it does turn on the amp bet not the PC).
I had to change the power button to hibernate (not the wol works)

how ever my question is why did it work when i use to shut down my pc (manually) without configuring the power button to hibernate.

can someone please take some time from your busy schedule and shed some light on this issue?

ps I may have always had the powerbotton set to hibernate and i just forgot.

thank you in advancve for your help