jfarmer08 / homebridge-wyze-smart-home

Wyze Smart Home plugin for Homebridge.
MIT License
93 stars 14 forks source link

Cannot set up Wyze Color Bulbs #238

Closed RitwikGupta closed 2 months ago

RitwikGupta commented 3 months ago

Describe The Bug: This is my first time setting up the plugin. When the plugin turns out, it boot loops with the following errors:

TypeError: Cannot read properties of null (reading 'r')
    at Object.colorsys.hex2Hsv (/homebridge/node_modules/homebridge-wyze-smart-home/node_modules/colorsys/colorsys.js:197:31)
    at WyzeMeshLight.updateColor (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:104:31)
    at WyzeMeshLight.updateCharacteristics (/homebridge/node_modules/homebridge-wyze-smart-home/src/accessories/WyzeMeshLight.js:69:46)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

and

AssertionError [ERR_ASSERTION]: Cannot generate setupURI on an accessory that isn't published yet!
    at Bridge.Accessory.setupURI (/homebridge/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Accessory.ts:994:11)
    at Server.setServerStatus (/homebridge/node_modules/homebridge/src/server.ts:155:45)
    at Server.teardown (/homebridge/node_modules/homebridge/src/server.ts:199:10)
    at signalHandler (/homebridge/node_modules/homebridge/src/cli.ts:93:12)
    at process.emit (node:events:518:28)
    at process.emit (/homebridge/node_modules/homebridge/node_modules/source-map-support/source-map-support.js:516:21)

I followed the advice in #198 and excluded the Color Bulbs by MAC address and that let the plug in boot up. When I re-enabled the devices, the problem started occurring again.

To Reproduce: Start the plugin for the first time with color bulbs already added to the Wyze app.

Expected behavior: The devices are published to Homebridge

Plugin Config:

{
    "name": "Wyze",
    "username": "XXX",
    "password": "XXX",
    "keyId": "XXX",
    "apiKey": "XXX",
    "refreshInterval": 60000,
    "hms": false,
    "showAdvancedOptions": true,
    "apiLogEnabled": false,
    "pluginLoggingEnabled": false,
    "lowBatteryPercentage": 30,
    "excludeMacAddress": false,
    "excludedeviceType": false,
    "platform": "WyzeSmartHome"
}

Environment:

github-actions[bot] commented 3 months ago

Message that will be displayed on users' first issue

RitwikGupta commented 3 months ago

Worth nothing that the plugin logs show that the plugin never really initializes?

[3/18/2024, 11:11:12 PM] [Wyze] Initializing WyzeSmartHome platform...
[3/18/2024, 11:11:50 PM] [Wyze] Initializing WyzeSmartHome platform...
[3/18/2024, 11:12:35 PM] [Wyze] Initializing WyzeSmartHome platform...
RitwikGupta commented 3 months ago

This seems related to #232. I have "Lamp 1" and "Lamp 2" set up in the Wyze app. If I exclude Lamp 2 by MAC (and Lamp 2 only), everything works. Is the issue with having more than one MeshLight or could the the issue be in the underlying Wyze API?

RitwikGupta commented 3 months ago

The above PR fixes the issue. Both lamps are added correctly and all operations work as intended.