kpsuperplane / homebridge-wiz-lan

Control Wiz lights over LAN
Apache License 2.0
115 stars 37 forks source link

Cannot read property 'state of undefined #58

Closed Dadbo closed 2 years ago

Dadbo commented 3 years ago

Recently some of my wiz bulbs have stopped responding. Here is the console output:

This plugin threw an error from the characteristic 'Color Temperature': Unhandled error thrown inside write handler for characteristic: Cannot read property 'state' of undefined. See https://git.io/JtMGR for more info.
[5/10/2021, 09:14:32] [homebridge-wiz-lan] TypeError: Cannot read property 'state' of undefined
    at Object.setPilot (/usr/local/lib/node_modules/homebridge-wiz-lan/src/accessories/WizBulb/pilot.ts:140:21)
    at Characteristic.<anonymous> (/usr/local/lib/node_modules/homebridge-wiz-lan/src/accessories/WizBulb/characteristics/temperature.ts:39:9)
    at Characteristic.emit (events.js:327:22)
    at /usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1632:16
    at new Promise (<anonymous>)
    at Characteristic.<anonymous> (/usr/local/lib/node_modules/homebridge/node_modules/hap-nodejs/src/lib/Characteristic.ts:1630:14)
    at step (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:143:27)
    at Object.next (/usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:124:57)
    at /usr/local/lib/node_modules/homebridge/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)

No changes on my end. 2 of my 3 wiz bulbs have stopped responding

MoTechnicalities commented 3 years ago

Check their IP addresses in your network router. Set them to reserved IP addresses. Then enter those "host" addresses into the HomeBridge configuration file. It worked for me and now I get excelente responses every time! 😀

I recommend setting all Wiz devices to Reserved IP Addresses (write them down). Also, highly recommend setting the Wiz plugin to run as a "child bridge". Again, mine has been running beautifully this way!

Dadbo commented 3 years ago

Thanks for the suggestions. I'll give that a try.

vipul261 commented 3 years ago

@Dadbo Were you able to fix the issue? I tried @MoTechnicalities's suggestions and added my device reserved ip directly in the config and made Wiz a child hub but I'm still getting the same error

MoTechnicalities commented 3 years ago

Just chiming in to let you know my setup is still working great, using HomeBridge. But also, be sure to check that everything is up to date regarding your Node.js and Npm versions.

vipul261 commented 3 years ago

Working fine for me also now, @Dadbo I followed the following steps in case you are still facing issues:

  1. Ensure everything is updated including wiz plugin and homebridge.
  2. Added bulbs manually with their reserved IPs
  3. Ran Wiz as a child Hub
  4. Removed Wiz Platform and re-added the complete config in homebridge.
  5. Added wiz child hub again in homekit.

Everything is working perfectly fine after this. Thanks @MoTechnicalities :)