Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for "undefi" property values on update
There was a bug where we try to pass the string "undefi" into the colorsys hex2Hsv method. The library does not handle this gracefully and it results in the error ``` TypeError: Cannot read properties of null (reading 'r') at Object.colorsys.hex2Hsv (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197:31) at WyzeMeshLight.updateColor (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:104:31) at WyzeMeshLight.updateCharacteristics (/var/lib/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:69:46) at processTicksAndRejections (node:internal/process/task_queues:95:5) ``` Here we add a check to the updateCharacteristics method (alongside two others that already existed) to ignore this invalid value rather than trying to act on it. In my local testing the ability to set colors was not impacted as logging seems to indicate a valid color is later provided for the same device. See: jfarmer08#251
- Loading branch information