AlexGustafsson / homebridge-wol

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

Latest 5.0 betas crashes on startup #189

Closed fearlesschicken closed 2 years ago

fearlesschicken commented 2 years ago

Version 5.0+ (both betas) crashes Homebridge on start

Configuration

My configuration looks like this:

        {
            "accessory": "NetworkDevice",
            "name": "username's Computer",
            "mac": "mac1",
            "ip": "192.168.1.50",
            "wakeGraceTime": 20,
            "shutdownCommand": "net rpc shutdown --ipaddress 192.168.1.50 --user `cat somepathtocreds`",
            "shutdownGraceTime": 20,
            "returnEarly": "True"
        },
        {
            "accessory": "NetworkDevice",
            "name": "username's MB",
            "mac": mac2",
            "ip": "192.168.1.53",
            "pingCommand": "ssh username@192.168.1.53 'if [[ $(pmset -g powerstate IODisplayWrangler | tail -1 | cut -c29) -lt 4 ]]; then; exit 1; else; echo 1; fi;'",
            "wakeCommand": "ssh username@192.168.1.53 caffeinate -u -t 300",
            "wakeGraceTime": 1,
            "shutdownCommand": "ssh username@192.168.1.53 pmset sleepnow",
            "shutdownGraceTime": 10,
            "returnEarly": "True"
        },
        {
            "accessory": "NetworkDevice",
            "name": "asdfjaskljfbad",
            "mac": "mac3",
            "ip": "192.168.1.70",
            "pingCommand": "ssh username@192.168.1.70 'if [[ $(pmset -g powerstate IODisplayWrangler | tail -1 | cut -c29) -lt 4 ]]; then; exit 1; else; echo 1; fi;'",
            "wakeCommand": "ssh username@192.168.1.70 caffeinate -u -t 300",
            "wakeGraceTime": 3,
            "shutdownCommand": "ssh username@192.168.1.70 pmset sleepnow",
            "shutdownGraceTime": 10,
            "returnEarly": "True"
        },

I get the following log:

error: Got incorrect value type for config key 'returnEarly' expected boolean, got 'string'
    at NetworkDeviceConfig.getBoolean (/usr/local/lib/node_modules/homebridge-wol/src/config.ts:104:13)
    at new NetworkDeviceConfig (/usr/local/lib/node_modules/homebridge-wol/src/config.ts:73:29)
    at new NetworkDevice (/usr/local/lib/node_modules/homebridge-wol/src/network-device.ts:38:19)
    at /usr/local/lib/node_modules/homebridge/src/server.ts:350:50
    at Array.forEach (<anonymous>)
    at Server.loadAccessories (/usr/local/lib/node_modules/homebridge/src/server.ts:270:29)
    at Server.start (/usr/local/lib/node_modules/homebridge/src/server.ts:162:12)

4.3.0 doesn't crash so I'm downgraded to that for now

fearlesschicken commented 2 years ago

I didn't notice the breaking change of "ip" being renamed to "host". I did update this but this had no effect on the crashing. I changed my returnEarly from "True" into true without quotes and this fixed it.