AlexGustafsson / homebridge-wol

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

macOS lock #203

Closed bulava92 closed 2 years ago

bulava92 commented 2 years ago

Backstory

No response

Issue

Hi

I have the latest version of the plugin, as well as homebridge, etc. everything used to work, but for some reason it stopped. The photo shows two ping commands - the upper one when the computer is unlocked, the lower one when the computer is locked. Why doesn't ping print 0, what to check?

FED7784F-75CB-4ECA-A71C-B80FD0120EE6

Environment

- os and os version:
- node version:
- homebridge version:
- homebridge-wol version:

Configuration

    {
        "name": "MacBook",
        "manufacturer": "homebridge-wol",
        "model": "NetworkDevice",
        "pingInterval": 15,
        "pingsToChange": 4,
        "pingTimeout": 1,
        "pingCommand": "sshpass -p '1234' ssh qwerty@192.168.1.90 'if [[ $(pmset -g powerstate IODisplayWrangler | tail -1 | cut -c29) -lt 4 ]]; then; exit 1; else; echo 1; fi;'",
        "pingCommandTimeout": 0,
        "mac": "",
        "startCommandTimeout": 0,
        "wakeGraceTime": 2,
        "wakeCommand": "sshpass -p '1234' ssh qwerty@192.168.1.90 'caffeinate -u -t 300'",
        "wakeCommandTimeout": 0,
        "shutdownCommand": "sshpass -p '1234' ssh qwerty@192.168.1.90 'pmset displaysleepnow'",
        "shutdownGraceTime": 2,
        "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:

Please paste your log here


### Notes

_No response_
AlexGustafsson commented 2 years ago

The command doesn't print anything, it exits with a special code. To get this code, you can usually run the following command after having run your ping command:

echo "$?"

Here, echo means that you want to print whatever comes after it and "$?" is a special variable that holds the exit code of the program run before it.

AlexGustafsson commented 2 years ago

This doesn't seem to be a bug, so I'm closing this issue. Feel free to open a discussion if your issue is not solved. Also, feel free to reopen this issue if you believe it's still a bug with the package itself.