Wake on Lan - switch status not working [SOLVED]

Hi all. I’m trying to get that Wake-on-LAN switch to work properly. It wakes up the computer fine but it doesn’t change its status accordingly once it has booted. I can ping and nmap the computer fine form the hass account on my Rpi. This are the relevant parts of the config. I also tried using the fritzbox for device tracking but without effect.

switch:
  - platform: wake_on_lan
    name: "server"
    mac_address: "70-85-C2-AA-BB-FA"
    host: "192.168.1.30"

device_tracker:    
  - platform: nmap_tracker
    hosts: 192.168.1.1/24

(Ubuntu 16.04, Raspberry Pi 3, virtualenv-installation, wired ethernet connection)

Thanks in advance,
Tobias

1 Like

Windows? Mine wouldn’t update until I turned network discovery on.

3 Likes

No, that particular computer is an Ubuntu 16.04. The device tracking works fine with nmap and WOL is works as well, but the switch status doesn’t.

1 Like

here is my working switch - windows 10 based system

  • platform: wake_on_lan
    mac_address: “00:1Y:D2:9B:91:9B”
    name: “wol_bedroom”
    host: “192.168.1.96”

possible the mac address wants : instead of a dash -

1 Like

The mac address is not the problem. I tried dash and colon as separator but no changes in behavior. Besides, it wakes the host just fine.

Hmm, you’re at least better off than I am. I’m unable to get the Windows 10 system to even wake. No errors shown in log.

Hi Brian, did you see Skullys post #2 about network discovery?

1 Like

Hi@brianjking
Maybe you have to enable WOL in the BIOS first

One of my systems will only wake from a complete shutdown and another will only wake from hibernate. Try different sleep states to see if that is the case.

@outrun – I’ve already enabled it in the BIOS.

@Skully @Cgtobi – What do you mean network discovery?

@norien – I’ve wondered about this as well. I’m pretty sure I’ve tried both hibernation and complete shutdown, however, no go as of yet. Will try again and see what I can figure out.

@brianjking, Network Discovery just underneath This PC had to be turned on for me to get a status of my machines in the front end.

With regards to WoL, do you have magic packet on in the adapter settings and Windows 10 fast startup turned off?

I’ve had it working on two different machines now doing the same.

I tried to investigate a little what might cause the switch not showing the correct status but I can’t replicate whatever HA is doing internally.

I wrote a little python script to ping the host the way HA does it but I only get what I expect, which doesn’t help really.

import platform
import subprocess as sp

DEFAULT_PING_TIMEOUT = 1
hosts = ('foo', '192.168.1.100', 'foo.local.')

for host in hosts:
    ping_cmd = 'ping -c 1 -W {} {}'.format(
                DEFAULT_PING_TIMEOUT, host)

    status = sp.getstatusoutput(ping_cmd)[0]
    print(host, status)
1 Like

May not be the answer you want but I had this issue a number of builds ago, a simple fresh install worked for me.

As the feature is not uber important to me I’d rather track down how it’s not working than simply hiding it by starting from scratch. WOL works, which is most important to me. I just wonder why the status is wrong.

1 Like

Well I have an interesting story. Originally I had my home assistant installed with allinone on a raspberry pi and I had 3 different wol switches working flawless.

Today I finished migration of my home assistant to a dedicated Ubuntu server in virtualenv and all 3 no longer report state on. The switches are working to power on the system’s but I am unable to use the off portion now as it won’t actually show they are on.

Maybe this has something to do with Ubuntu?

I had the same problem, and for me it was the PATH problem, I had to write the hole path inside the python files, instead of ping, /usr/bin/ping

1 Like

Interesting, but the script in this post works fine without the path (for me at least). How is it for you @norien?

1 Like

I dont even know how to begin to run that yet haha. I certainly will try it out if I knew how.

Could you elaborate a little? Which files should I be looking for. my ping is sitting in, /bin/ping - so not sure if it’s different due to being a newer ubuntu server install?

Just in case, I opened an an issue on github about this problem.

@norien simply log into your ha instance with your ha user (eg. hass) and execute which ping. This will probably give you something like /bin/ping. As long as /bin is in your PATH environment variable (check with export | grep PATH) everything should be fine.

Besides, as my little script shows, it has most likely nothing to do with the PATH variable in my opinion.

2 Likes