AlexGustafsson / homebridge-wol

A Wake on Lan plugin for Homebridge
MIT License
301 stars 30 forks source link

magic packets sent not waking pc anymore #250

Open pizzaboy314 opened 1 year ago

pizzaboy314 commented 1 year ago

Backstory

i hadn't updated or restarted Homebridge or my plugins in a while. after restarting Homebridge recently after disabling another plugin, this plugin stopped waking my PC.

Issue

i did take steps to update Homebridge and this WoL plugin to the most recent version, but the problem persists.

i recently set up a Home Assistant server and i was able to confirm my PC's WoL settings are right by testing it with Home Assistants developer service _wake_on_lan.send_magicpacket, when i tested this with my mac address the PC woke up immediately

Environment

assuming homebridge host OS?
- os and os version: Win10 (10.0, build 19045)
- node version: 18.18.0
- homebridge version: 1.6.1
- homebridge-wol version: 5.0.2

Configuration

{
    "bridge": {
        "name": "Homebridge 3F2D",
        "username": "REDACTED",
        "port": REDACTED,
        "pin": "REDACTED"
    },
    "accessories": [
        {
            "name": "SPAHRTAN-RIG-2021",
            "manufacturer": "homebridge-wol",
            "model": "NetworkDevice",
            "host": "10.0.0.216",
            "pingInterval": 2,
            "pingsToChange": 5,
            "pingTimeout": 1,
            "pingCommandTimeout": 0,
            "mac": "REDACTED",
            "startCommandTimeout": 0,
            "wakeGraceTime": 45,
            "wakeCommandTimeout": 0,
            "shutdownGraceTime": 15,
            "shutdownCommandTimeout": 0,
            "logLevel": "Debug",
            "returnEarly": false,
            "accessory": "NetworkDevice"
        }
    ],
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config"
        },
        {
            "refreshToken": "REDACTED",
            "platform": "Ring"
        },
        {
            "name": "Hue",
            "anyOn": true,
            "effects": false,
            "groups": true,
            "lights": true,
            "nativeHomeKitLights": true,
            "nativeHomeKitSensors": true,
            "resource": true,
            "rooms": true,
            "scenes": true,
            "scenesAsSwitch": true,
            "schedules": true,
            "users": {
                "ECB5FAFFFE1C2196": "REDACTED"
            },
            "wallSwitch": true,
            "platform": "Hue"
        }
    ],
    "disabledPlugins": [
        "homebridge-hue"
    ]
}

Logs

When I follow these steps:

  1. Make sure logLevel is set to Debug on all NetworkDevice accessories
  2. Run homebridge
  3. Let it run for a couple of minutes
  4. Try to turn a device on or off using the plugin
  5. Wait one minute
  6. Repeat step 4

I get the following log:

[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got user-triggered state change: 1
[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Awake cycle started
[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Attempting to wake up device
[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Device went from status "Offline" to "WakingUp"
[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [Pinger] Stopping pinger
[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Attempting to start device by sending a WoL packet
[10/11/2023, 1:06:19 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Waiting for wake grace time (45000ms)
[10/11/2023, 1:06:29 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got state request - reporting WakingUp
[10/11/2023, 1:06:29 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got user-triggered state change: 1
[10/11/2023, 1:07:04 PM] [SPAHRTAN-RIG-2021] [Pinger] Stopping pinger
[10/11/2023, 1:07:04 PM] [SPAHRTAN-RIG-2021] [Pinger] Starting pinger at an interval of 2000 milliseconds
[10/11/2023, 1:07:04 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:07:05 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:07:05 PM] [SPAHRTAN-RIG-2021] [Pinger] Got 0 positives out of 1
[10/11/2023, 1:07:05 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got state change from pinger: offline
[10/11/2023, 1:07:05 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] The device is no longer accessible - assuming offline
[10/11/2023, 1:07:05 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Device went from status "WakingUp" to "Offline"
[10/11/2023, 1:07:07 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:07:08 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:07:09 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:07:10 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:07:11 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:07:12 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:07:13 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:07:14 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:07:15 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:07:16 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:07:16 PM] [SPAHRTAN-RIG-2021] [Pinger] Got 0 positives out of 5
[10/11/2023, 1:07:16 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got state change from pinger: offline

after one minute

[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got user-triggered state change: 1
[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Awake cycle started
[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Attempting to wake up device
[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Device went from status "Offline" to "WakingUp"
[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [Pinger] Stopping pinger
[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Attempting to start device by sending a WoL packet
[10/11/2023, 1:10:15 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Waiting for wake grace time (45000ms)
[10/11/2023, 1:10:24 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got state request - reporting WakingUp
[10/11/2023, 1:10:24 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got user-triggered state change: 1
[10/11/2023, 1:11:00 PM] [SPAHRTAN-RIG-2021] [Pinger] Stopping pinger
[10/11/2023, 1:11:00 PM] [SPAHRTAN-RIG-2021] [Pinger] Starting pinger at an interval of 2000 milliseconds
[10/11/2023, 1:11:00 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:11:01 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:11:01 PM] [SPAHRTAN-RIG-2021] [Pinger] Got 0 positives out of 1
[10/11/2023, 1:11:01 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got state change from pinger: offline
[10/11/2023, 1:11:01 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] The device is no longer accessible - assuming offline
[10/11/2023, 1:11:01 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Device went from status "WakingUp" to "Offline"
[10/11/2023, 1:11:03 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:11:04 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:11:05 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:11:06 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:11:07 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:11:08 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:11:09 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:11:10 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:11:11 PM] [SPAHRTAN-RIG-2021] [Pinger] Attempting to ping host '10.0.0.216'
[10/11/2023, 1:11:12 PM] [SPAHRTAN-RIG-2021] [Pinger] Result of pinging: offline
[10/11/2023, 1:11:12 PM] [SPAHRTAN-RIG-2021] [Pinger] Got 0 positives out of 5
[10/11/2023, 1:11:12 PM] [SPAHRTAN-RIG-2021] [NetworkDevice] Got state change from pinger: offline


### Notes

_No response_
megaphonixmusic commented 1 year ago

Confirming this plugin has also stopped working for me for a little while now. I'd say on the order of 2-3 weeks.

(No change to the PC's static IP)

pizzaboy314 commented 1 year ago

Confirming this plugin has also stopped working for me for a little while now. I'd say on the order of 2-3 weeks.

(No change to the PC's static IP)

that timeline sounds right for my experience as well

I'm now working around this issue by using Home Assistant's WoL feature and passing it through to homekit as a switch

alissaman commented 1 year ago

Try deleting these two lines from your config, I had similar issues and this plugin worked again after removal.

        "startCommandTimeout": 0,
        "shutdownCommandTimeout": 0,
megaphonixmusic commented 1 year ago

Try deleting these two lines from your config, I had similar issues and this plugin worked again after removal.

        "startCommandTimeout": 0,
        "shutdownCommandTimeout": 0,

Just tried this and restarted my Homebridge, still not working unfortunately.

HobaiRiku commented 1 year ago

advice to change wake_on_lan to wakeonlan to fix this

michelebombardi commented 1 year ago

Same issue here, since about two week this stopped working suddendly, without any reason. No ping and no magic packet. Please, any solutions?

andywaplinger commented 11 months ago

My solution to this was to install etherwake on my Raspberry Pi, then set the Start command to wakeonlan [WOL_MAC_ADDRESS] - works great! Love that I can now wake up and suspend my PC with automation.

megaphonixmusic commented 11 months ago

So I tried diving into my PC's BIOS just to double check my settings, and it turns out there was a "Boot From Onboard LAN" setting that was set to "Disabled" for some reason. I enabled that and this switch is working for me again... Your mileage may vary, but I suggest double checking your BIOS and Windows settings to ensure they didn't get changed like mine did somehow.

AlexGustafsson commented 10 months ago

It's interesting that you have seen the issue pop up around the same time, a time around which this plugin hadn't been updated. Could it be that some BIOS or Windows update changed the settings for Wake On LAN?

pizzaboy314 commented 10 months ago

It's interesting that you have seen the issue pop up around the same time, a time around which this plugin hadn't been updated. Could it be that some BIOS or Windows update changed the settings for Wake On LAN?

No, because within one day of this plugin no longer working, I set up a Home Assistant server and the built in WoL worked immediately with no changes to Windows.

AlexGustafsson commented 10 months ago

It's weird that something would break out of nowhere without changes anywhere. I'll keep the issue open for a while to see if anyone else has something to add. Otherwise I'll probably close this as there's been no related change made in a long time, so there's nothing that can be changed in the plugin to fix this. It's likely some external factor.

alissaman commented 10 months ago

I suspect that an update to HomeBridge or Raspbian caused the issue.

What I observe is that it might get stuck in the shutting down state, and does not move to offline.

The pc does get successfully shutdown and stops responding to pings.

[25/01/2024, 09:13:58] [Home PC] [NetworkDevice] Shutdown cycle started [25/01/2024, 09:13:58] [Home PC] [NetworkDevice] Device went from status "Online" to "ShuttingDown" [25/01/2024, 09:13:58] [Home PC] [NetworkDevice] Attempting to shut down the device using "ssh"

When it works correctly the following two log entries are recorded: [NetworkDevice] Waiting for shutdown grace time (NaNms) [NetworkDevice] Device went from status "ShuttingDown" to "Offline"

This issue could be related to or caused by https://github.com/AlexGustafsson/homebridge-wol/issues/255

rockychf commented 10 months ago

My issue #255 is mainly focus on the "detecting" part of online PC (whether the PC is on or off, it only shows the PC is turning off), the turn on feature for PC is working as expect.

michelebombardi commented 10 months ago

In my case was fault of Homebridge (installed on Synology NAS) that, after an update, was unable to ping my computer.

To solve, I connected via SSH to the NAS as root user and executed the following command:

setcap 'cap_net_raw+ep' $(which ping)

Then everything went back working as before. Hope this will help someone else!