luisiam / homebridge-cmdswitch2

CMD Plugin for HomeBridge (API 2.0): https://github.com/nfarina/homebridge
Apache License 2.0
176 stars 29 forks source link

How to disable cmd_off? #62

Open bluefangs opened 4 years ago

bluefangs commented 4 years ago

I'd like to know if there is a way to disable cmd_off. I want to be able to turn on the switch if it's off (off will be reported via polling) but never turn it off.

Setting cmd_off: "" or removing cmd_off altogether causes an exception in homebridge and it restarts.

Thanks

bluefangs commented 4 years ago

Although cmd_on and cmd_off params are not required as per readme, when I do not specify the fields, I get the below error:

[6/14/2020, 9:46:36 PM] TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
    at validateString (internal/validators.js:120:11)
    at normalizeSpawnArguments (child_process.js:406:3)
    at spawn (child_process.js:542:16)
    at Object.execFile (child_process.js:232:17)
    at exec (child_process.js:153:25)
    at cmdSwitchPlatform.setPowerState (/homebridge/node_modules/homebridge-cmdswitch2/index.js:222:3)
    at Characteristic.emit (events.js:315:20)
    at Characteristic.EventEmitter.emit (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/EventEmitter.ts:42:22)
    at Characteristic._this.setValue (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:625:12)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:1437:24
[6/14/2020, 9:46:36 PM] Got SIGTERM, shutting down Homebridge...
[6/14/2020, 9:46:41 PM] [HB Supervisor] Homebridge Process Ended. Code: 143, Signal: null
[6/14/2020, 9:46:46 PM] [HB Supervisor] Restarting Homebridge...