What's new

Auto Wake On Lan?

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

gil80

Regular Contributor
I'm using Home Assistant running on a NUC type PC.
Though the Bios is set to power on the device after a power loss, it doesn't work.

So I have to manually use WOL feature from within the router if I'm away.

Is it possible to auto run a script for WOL after a power loss?
 
The router doesn't have a way of differentiating between a reboot caused by a power outage and a reboot caused by a deliberate action (e.g. manual power off/on, scheduled reboot, etc.). You could set the router to issue a WoL every time it boots up, but that's not quite the same.
 
The router doesn't have a way of differentiating between a reboot caused by a power outage and a reboot caused by a deliberate action (e.g. manual power off/on, scheduled reboot, etc.). You could set the router to issue a WoL every time it boots up, but that's not quite the same.
That would still work for me.
How can I auto issue WOL every time it boots up?
 
I would create a /jffs/scripts/services-start user script as follows:
Code:
#!/bin/sh
ether-wake -i br0 -b 11:22:33:44:55:66
Replace 11:22:33:44:55:66 with the MAC address of your NUC.
 
I would create a /jffs/scripts/services-start user script as follows:
Code:
#!/bin/sh
ether-wake -i br0 -b 11:22:33:44:55:66
Replace 11:22:33:44:55:66 with the MAC address of your NUC.
Okay, I'm confused again. I thought the -b broadcasted to all, not just one MAC. What happens if there is no -b?
 
I would create a /jffs/scripts/services-start user script as follows:
Code:
#!/bin/sh
ether-wake -i br0 -b 11:22:33:44:55:66
Replace 11:22:33:44:55:66 with the MAC address of your NUC.
ok, so I enabled the JFFS partition and SSH'd to it.
I used `nano` to create the script `wol.sh` and copied your example but used my machine's MAC address.
I then issued `chmod +x wol.sh`

That should be enough?
 
Okay, I'm confused again. I thought the -b broadcasted to all, not just one MAC.
That's correct. The Ethernet broadcast address is FF:FF:FF:FF:FF:FF. The "11:22:33:44:55:66" in the example is what's inserted into the payload of the magic packet.
What happens if there is no -b?
It uses the MAC address of the target machine ("11:22:33:44:55:66" in the example) instead of FF:FF:FF:FF:FF:FF.
 
That's correct. The Ethernet broadcast address is FF:FF:FF:FF:FF:FF. The "11:22:33:44:55:66" in the example is what's inserted into the payload of the magic packet.

It uses the MAC address of the target machine ("11:22:33:44:55:66" in the example) instead of FF:FF:FF:FF:FF:FF.
Thanks. So that difference is that with -b, all clients will receive a magic packet but they are suppose to ignore it unless their mac matches what is in the payload? Sounds like one should only use -b if it doesn't work without it.
 
In theory -b should be more reliable and is what the router's GUI WoL function uses. I can't see any downside for using -b.
 
I'm using Home Assistant running on a NUC type PC.
Though the Bios is set to power on the device after a power loss, it doesn't work.

So I have to manually use WOL feature from within the router if I'm away.

Is it possible to auto run a script for WOL after a power loss?
You could have a bash script that say pings the NUC every so many minutes and if it gets a responds do nothing, but if it does not get a responds, then sent the WOL command.
 
Yes. (as well as having enabled custom scripts in the GUI)
So after having a power outage, the script didn't wake my HA server.
I have enabled custom scripts in the GUI.
Provided the right permission to execute the script. Used the MAC address of the device.
What else could it be?
Manually, the WOL works.
 
So after having a power outage, the script didn't wake my HA server.
I don't think WOL will work if the BIOS setting isn't working. The NIC has to be powered.
 
I don't think WOL will work if the BIOS setting isn't working. The NIC has to be powered.
Manually it works. If I go to the router's Network Tools and select the MAC address, it will wake the device... so what's the difference if I do it via script?
 
Where do you call script from? service-start?
 
Where do you call script from? service-start?
yes, and to be sure I logged in and I saw that the folder was gone. I think since the last Merlin fw update, this folder got deleted, which explains why that didn't work for me.
I recreated the folder and the script:

Note: I named the folder `services-start` - and not `service-start` - is that correct?

1716290625735.png
 
Last edited:
Note: I named the folder `services-start` - and not `service-start` - is that correct?
I believe that services-start is a file in the /jffs/scripts/ folder, and is not itself a folder.
As far as I am aware there is no services-start folder; services-start with a plural s.
 
Last edited:

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top