pschroeder89 / homebridge-levoit-humidifiers

Levoit Humidifiers Plugin for Apple HomeKit via Homebridge
Apache License 2.0
70 stars 9 forks source link

This plugin generated a warning from the characteristic 'On': characteristic value expected boolean and received undefined. #74

Closed lintegras closed 9 months ago

lintegras commented 10 months ago

Describe The Bug: 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.

NOTE: I do have a Levoit purifier and humidifier; device discovery pulls both successfully. I am unsure if the error is associated to the purifier.

To Reproduce: Load and configure plugin, launch Homebridge.

Expected behavior: Absence of warning in logs.

Logs:

[1/30/2024, 1:56:13   PM] Homebridge v1.7.0 (HAP v0.11.1) (Homebridge 37D2) is running on port   51669.
--
[1/30/2024, 1:56:13 PM] [Levoit   Humidifiers] [DEBUG]: [LOGIN] Authentication was successful
[1/30/2024, 1:56:13 PM] [Levoit   Humidifiers] Discovering devices...
[1/30/2024, 1:56:14 PM] [Levoit   Humidifiers] [DEBUG]: [GET DEVICES] Device List -> JSON:   [{"deviceRegion":"US","isOwner":true,"authKey":null,"deviceName":"HoMe   Purifier","deviceImg":"https://image.vesync.com/defaultImages/deviceDefaultImages/wfon_apr_lap-c601s-wus_us_240.png","cid":"<removed in case identifying>","deviceStatus":"on","connectionStatus":"online","connectionType":"WiFi+BTOnboarding+BTNotify","deviceType":"LAP-C601S-WUS","type":"wifi-air","uuid":"<removed in case identifying>","configModule":"WFON_APR_LAP-C601S-WUS_US","macID":"<removed in case identifying>","mode":null,"speed":null,"currentFirmVersion":null,"subDeviceNo":null,"subDeviceType":null,"deviceFirstSetupTime":"Nov   17, 2022 7:57:25   PM","subDeviceList":null,"extension":{"airQuality":-1,"airQualityLevel":1,"mode":"auto","fanSpeedLevel":"1"},"deviceProp":null},{"deviceRegion":"US","isOwner":true,"authKey":null,"deviceName":"Nursery   humidifier   ","deviceImg":"https://image.vesync.com/defaultImages/deviceDefaultImages/wifibtonboardingnotify_airhumidifier_classic200s_us_240.png","cid":"<removed in case identifying>","deviceStatus":"off","connectionStatus":"online","connectionType":"WiFi+BTOnboarding+BTNotify","deviceType":"Classic200S","type":"wifi-air","uuid":"<removed in case identifying>","configModule":"WiFiBTOnboardingNotify_AirHumidifier_Classic200S_US","macID":"<removed in case identifying>","mode":null,"speed":null,"currentFirmVersion":null,"subDeviceNo":null,"subDeviceType":null,"deviceFirstSetupTime":"Nov   1, 2022 11:29:28 PM","subDeviceList":null,"extension":null,"deviceProp":null}]
[1/30/2024, 1:56:14 PM] [Levoit   Humidifiers] [DEBUG]: [GET DEVICE INFO] Getting device info...
[1/30/2024, 1:56:14 PM] [Levoit   Humidifiers] [DEBUG]: [DEVICE INFO]   {"traceId":"1706648174163","code":0,"msg":"request   success","module":null,"stacktrace":null,"result":{"traceId":"1706648174163","code":0,"result":{"enabled":false,"mist_virtual_level":9,"mist_level":3,"mode":"manual","water_lacks":false,"water_tank_lifted":false,"humidity":0,"humidity_high":false,"indicator_light_switch":false,"automatic_stop_reach_target":false,"configuration":{"auto_target_humidity":80,"indicator_light_switch":false,"automatic_stop":false}}}}
[1/30/2024, 1:56:14 PM] [Levoit   Humidifiers] Restoring existing accessory from cache: Nursery humidifier
[1/30/2024, 1:56:14 PM]   [homebridge-levoit-humidifiers] 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.
[1/30/2024, 1:56:14 PM]   [homebridge-levoit-humidifiers] Error:
at On.Characteristic.characteristicWarning   (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:3011:105)
at On.Characteristic.validateUserInput   (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2887:12)
at On.<anonymous>   (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:2405:24)
at step   (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:195:27)
at Object.next   (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:176:57)
at fulfilled   (/homebridge/node_modules/homebridge/node_modules/tslib/tslib.js:166:62)
at processTicksAndRejections (node:internal/process/task_queues:95:5)

Plugin Config:

{
--
"name": "Levoit Humidifiers",
"email": <removed>,
"password": <removed>,
"accessories": {
"humidity_sensor": true,
"mist": true,
"warm_mist": false,
"sleep_mode": false,
"display": true,
"night_light": false,
"auto_pro": false
},
"options": {
"showOffWhenDisconnected": false
},
"platform": "LevoitHumidifiers",
"enableDebugMode": true
}

Screenshots: image

Environment:

lintegras commented 10 months ago

Additional note - I updated node.js to v20.11.0 and that did not impact the issue.

pschroeder89 commented 10 months ago

@lintegras I published 1.12.4, which should prevent this error. But something seems wrong with your device to get this error, On should never be undefined. In the response, it even looks normal, so I'm unsure why Homebridge read the value as undefined. Let me know if 1.12.4 works better, and if not, we'll have to investigate some more.

lintegras commented 9 months ago

@pschroeder89 evidence on my end indicates the changes you made have resolved this issue. I realized after you mentioned there must be an issue with my device that the humidity sensor on the device is no longer reporting a value back (always shows 0%) in the native app; this may have contributed to the error.

Thank you for the quick investigation and resolution to this one-off problem.