hjdhjd / homebridge-myq

:car: myQ Liftmaster and Chamberlain Plugin for Homebridge https://github.com/nfarina/homebridge
Other
568 stars 44 forks source link

Lamp: characteristic value error #1106

Closed jarz closed 1 year ago

jarz commented 1 year ago

Describe The Problem: Homebridge logs the following error when processing a lamp accessory: This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://homebridge.io/w/JtMGR for more info.

To Reproduce: Start/restart Homebridge with a lamp accessory connected to the MyQ account.

Logs:

[9/9/2023, 12:41:59 PM] [homebridge-myq] This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. See https://homebridge.io/w/JtMGR for more info.
logger.js:121
[9/9/2023, 12:41:59 PM] [homebridge-myq] Error: 
    at On.Characteristic.characteristicWarning (/Users/tim/code/github/hjdhjd/homebridge-myq/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
    at On.Characteristic.validateUserInput (/Users/tim/code/github/hjdhjd/homebridge-myq/node_modules/hap-nodejs/src/lib/Characteristic.ts:2887:12)
    at On.Characteristic.updateValue (/Users/tim/code/github/hjdhjd/homebridge-myq/node_modules/hap-nodejs/src/lib/Characteristic.ts:2328:20)
    at Switch.Service.updateCharacteristic (/Users/tim/code/github/hjdhjd/homebridge-myq/node_modules/hap-nodejs/src/lib/Service.ts:795:35)
    at myQLamp.configureLamp (file:///Users/tim/code/github/hjdhjd/homebridge-myq/src/myq-lamp.ts:58:19)
    at myQLamp.configureDevice (file:///Users/tim/code/github/hjdhjd/homebridge-myq/src/myq-lamp.ts:23:10)
    at new myQAccessory (file:///Users/tim/code/github/hjdhjd/homebridge-myq/src/myq-device.ts:63:10)
    at new myQLamp (file:///Users/tim/code/github/hjdhjd/homebridge-myq/src/myq-lamp.ts:8:7)
    at myQPlatform.discoverAndSyncAccessories (file:///Users/tim/code/github/hjdhjd/homebridge-myq/src/myq-platform.ts:251:52)
    at myQPlatform.updateAccessories (file:///Users/tim/code/github/hjdhjd/homebridge-myq/src/myq-platform.ts:296:10)

Homebridge Configuration: N/A

Screenshots: N/A

Environment:

jarz commented 1 year ago

I'll have a PR for this and another lamp-related issue in a bit.

hjdhjd commented 1 year ago

Should be quick...you can do:

switchService.updateCharacteristic(this.hap.Characteristic.On, (this.accessory.context.lampState as boolean) === true);

hjdhjd commented 1 year ago

I pushed an update to GH...if you want to give it a test, I'll get it published along with a couple of other minor things later today. Good to hear from you @jarz 😄

jarz commented 1 year ago

👍 -- works on my test instance.

github-actions[bot] commented 1 year ago

This issue is locked to prevent necroposting on closed issues. Please create a new issue for related support requests, bug reports, or feature suggestions.