AlexGustafsson / homebridge-wol

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

Can't shutdown my computer with the shutdown command #214

Closed melhafid closed 2 years ago

melhafid commented 2 years ago

Backstory

Hi, I was trying the plugin so that it could turn my computer on and off whenever i wanted.

Somehow I managed to turn it on, but impossible for me to turn it off.

Issue

Here is what the log returns :

[9/6/2022, 4:26:32 AM] [PC-MOUSSA] [NetworkDevice] Attempting to shut down the device using "net"
[9/6/2022, 4:26:32 AM] [PC-MOUSSA] [NetworkDevice] HWOL-4001 An error occurred while trying to shut down the device. This is most likely not an issue with homebridge-wol itself. For more information see https://github.com/AlexGustafsson/homebridge-wol/wiki/Frequently-Asked-Questions#hwol-4001
[9/6/2022, 4:26:32 AM] [PC-MOUSSA] [NetworkDevice] Waiting for shutdown grace time (NaNms)
[9/6/2022, 4:26:47 AM] [PC-MOUSSA] [NetworkDevice] Device went from status "ShuttingDown" to "Online"

Environment

- os and os version: Mac OS 12.4
- node version: 16.16.0
- homebridge version: 1.5.0
- homebridge-wol version: 5.0.2

Configuration

Here is my config.json file

"accessories": [
        {
            "name": "PC-MOUSSA",
            "manufacturer": "homebridge-wol",
            "model": "NetworkDevice",
            "mac": "MAC-ADDRESS",
            "ip": "192.168.1.21",
            "host": "192.168.1.21",
            "startCommandTimeout": 0,
            "wakeGraceTime": 20,
            "wakeCommandTimeout": 0,
            "shutdownCommand": "net rpc shutdown --ipaddress 192.168.1.21 --user moussa/elhaf%0421",
            "shutdownGraceTime": 15,
            "shutdownCommandTimeout": 0,
            "logLevel": "Info",
            "returnEarly": false,
            "accessory": "NetworkDevice"

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:

[9/6/2022, 4:49:53 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting Online
[9/6/2022, 4:49:53 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:49:53 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:49:54 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting Online
[9/6/2022, 4:49:55 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:49:55 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:49:57 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:49:57 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:49:59 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:49:59 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:01 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:01 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:01 AM] [PC-MOUSSA] [Pinger] Got 5 positives out of 5
[9/6/2022, 4:50:01 AM] [PC-MOUSSA] [NetworkDevice] Got state change from pinger: online
[9/6/2022, 4:50:03 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:03 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:05 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:05 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:06 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting Online
[9/6/2022, 4:50:07 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:07 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:09 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:09 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:10 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting Online
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] Got user-triggered state change: 0
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] Shutdown cycle started
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] Device went from status "Online" to "ShuttingDown"
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [Pinger] Stopping pinger
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] Attempting to shut down the device using "net"
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] HWOL-4001 An error occurred while trying to shut down the device. This is most likely not an issue with homebridge-wol itself. For more information see https://github.com/AlexGustafsson/homebridge-wol/wiki/Frequently-Asked-Questions#hwol-4001
[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] Error: Command failed: net rpc shutdown --ipaddress 192.168.1.21 --user elhaf%0421
/bin/sh: net: command not found

[9/6/2022, 4:50:11 AM] [PC-MOUSSA] [NetworkDevice] Waiting for shutdown grace time (NaNms)
[9/6/2022, 4:50:12 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:50:15 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:50:16 AM] [Google Smart Home] Finished instance discovery
[9/6/2022, 4:50:20 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:50:21 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [Pinger] Stopping pinger
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [Pinger] Starting pinger at an interval of 2000 milliseconds
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [Pinger] Got 1 positives out of 1
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [NetworkDevice] Got state change from pinger: online
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [NetworkDevice] The device is now accessible - assuming online
[9/6/2022, 4:50:26 AM] [PC-MOUSSA] [NetworkDevice] Device went from status "ShuttingDown" to "Online"
[9/6/2022, 4:50:28 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:28 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:30 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:30 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:31 AM] [Google Smart Home] Sending Sync Request
[9/6/2022, 4:50:32 AM] [Google Smart Home] Received SYNC intent
[9/6/2022, 4:50:32 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:32 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:34 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:34 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:36 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:36 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:36 AM] [PC-MOUSSA] [Pinger] Got 5 positives out of 5
[9/6/2022, 4:50:36 AM] [PC-MOUSSA] [NetworkDevice] Got state change from pinger: online
[9/6/2022, 4:50:38 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:38 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:40 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:40 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:42 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:42 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:44 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:44 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:46 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:46 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:46 AM] [PC-MOUSSA] [Pinger] Got 5 positives out of 5
[9/6/2022, 4:50:46 AM] [PC-MOUSSA] [NetworkDevice] Got state change from pinger: online
[9/6/2022, 4:50:48 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:48 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:50 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:50 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:52 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:52 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:54 AM] [PC-MOUSSA] [Pinger] Attempting to ping host '192.168.1.21'
[9/6/2022, 4:50:54 AM] [PC-MOUSSA] [Pinger] Result of pinging: online
[9/6/2022, 4:50:55 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting Online
[9/6/2022, 4:50:55 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting Online
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] Got user-triggered state change: 0
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] Shutdown cycle started
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] Device went from status "Online" to "ShuttingDown"
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [Pinger] Stopping pinger
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] Attempting to shut down the device using "net"
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] HWOL-4001 An error occurred while trying to shut down the device. This is most likely not an issue with homebridge-wol itself. For more information see https://github.com/AlexGustafsson/homebridge-wol/wiki/Frequently-Asked-Questions#hwol-4001
[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] Error: Command failed: net rpc shutdown --ipaddress 192.168.1.21 --user elhaf%0421
/bin/sh: net: command not found

[9/6/2022, 4:50:56 AM] [PC-MOUSSA] [NetworkDevice] Waiting for shutdown grace time (NaNms)
[9/6/2022, 4:50:57 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:51:00 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:51:05 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown
[9/6/2022, 4:51:06 AM] [PC-MOUSSA] [NetworkDevice] Got state request - reporting ShuttingDown```

Notes

No response