Zacknetic / HomebridgeMagicHome-DynamicPlatform

Homebridge Plugin for MagicHome LED controllers and light bulbs
Apache License 2.0
61 stars 11 forks source link

Cannot read property 'controllerType' of undefined #26

Closed CAuguston closed 3 years ago

CAuguston commented 4 years ago

Im getting the following error: I removed uniqueID's and IP's

[9/11/2020, 10:13:05 PM] [homebridge-magichome-dynamic-platform] Registering cached accessory 'LED Kitchen' Model: 'AK001-ZJ210' Unique ID: 'xxxxxxxxxxxx' IP-Address: 'xxx.xx.x.xxx' Version 6 Version Modifier: 51

[9/11/2020, 10:13:05 PM] [homebridge-magichome-dynamic-platform] TypeError: Cannot read property 'controllerType' of undefined at HomebridgeMagichomeDynamicPlatform.discoverDevices (/homebridge/node_modules/homebridge-magichome-dynamic-platform/src/platform.ts:308:94) at processTicksAndRejections (internal/process/task_queues.js:97:5) [9/11/2020, 10:13:05 PM] [homebridge-magichome-dynamic-platform] Warning! Continuing to register cached accessory 'LED Bedroom' despite not being seen for 2 restarts. Model: 'AK001-ZJ210' Unique ID: 'xxxxxxxxxxxx' IP-Address: 'xxx.xx.x.xxx' Version 6 Version Modifier: 51

[9/11/2020, 10:13:05 PM] [homebridge-magichome-dynamic-platform] Warning! Continuing to register cached accessory 'LED Living Room' despite not being seen for 5 restarts. Model: 'AK001-ZJ210' Unique ID: 'xxxxxxxxxxxx' IP-Address: 'xxx.xx.x.xxx' Version 6 Version Modifier: 51

[9/11/2020, 10:13:05 PM] [homebridge-magichome-dynamic-platform] Registered 0 Magichome device(s). New devices: 0 Cached devices that were seen this restart: 0 Cached devices that were not seen this restart: 0

Zacknetic commented 4 years ago

Hi, the most recent update has mostly likely caused your issue. Unfortunately it comes with the cost of some incompatible changes but with the benefit of more accurate status retrieval. So lights should more accurately display their color, brightness, and on/off status.

  1. Just to be sure please check if the plugin needs an update in config ui x > plugins > homebridge-magichome-dynamic-platform > update.
  2. This is important! Next, purge all magic-home accessories by going to config ui x > plugins > homebridge-magichome-dynamic-platform > settings > checkmark "Prune All Accessories Next Restart (Warning Dangerous!)" > restart homebridge at least twice
  3. Lastly un-checkmark "Prune All Accessories Next Restart (Warning Dangerous!)" > restart homebridge.

That should solve your issue. Please let me know.

I wish I had a means of announcing potential plugin breaking changes that require a complete accessory purge. I have just released a patreon page, I think I can post free status updates there even for non subscribers. I will look into it.

CAuguston commented 4 years ago

That allowed the devices to be added again. They are no name brand lights so the message today may be related to that.. However in homebridge the LED lights to function now. Thanks as always for your support of the community and your coding skills.

Here is the logs after setting the purge, reboot x2, uncheck purge, reboot.

[9/12/2020, 2:03:14 PM] [homebridge-magichome-dynamic-platform] ( Scan: 1 ) Discovered zero devices... rescanning... [9/12/2020, 2:03:16 PM] [homebridge-magichome-dynamic-platform] ( Scan: 2 ) Discovered zero devices... rescanning... [9/12/2020, 2:03:18 PM] [homebridge-magichome-dynamic-platform] Discovered 3 devices.

[9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Uknown light version: 6... type probably cannot be set. Trying anyway... [9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Please create an issue at https://github.com/Zacknetic/HomebridgeMagicHome-DynamicPlatform/issues and post your homebridge.log HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Registering new accessory 'Simple RGB' Model: 'AK001-ZJ210' Unique ID: 'xxxxxxx' IP-Address: 'xxxxx' Version 6 Version Modifier: 51

[9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Uknown light version: 6... type probably cannot be set. Trying anyway... [9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Please create an issue at https://github.com/Zacknetic/HomebridgeMagicHome-DynamicPlatform/issues and post your homebridge.log HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Registering new accessory 'Simple RGB' Model: 'AK001-ZJ210' Unique ID: 'xxxxxxx' IP-Address: 'xxxxxx' Version 6 Version Modifier: 51

[9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Uknown light version: 6... type probably cannot be set. Trying anyway... [9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Please create an issue at https://github.com/Zacknetic/HomebridgeMagicHome-DynamicPlatform/issues and post your homebridge.log HAP Warning: Characteristic 000000E3-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 00000043-0000-1000-8000-0026BB765291. Adding anyway. [9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Registering new accessory 'Simple RGB' Model: 'AK001-ZJ210' Unique ID: 'xxxxxx' IP-Address: 'xxxxx' Version 6 Version Modifier: 51

[9/12/2020, 2:03:19 PM] [homebridge-magichome-dynamic-platform] Registered 3 Magichome device(s). New devices: 3 Cached devices that were seen this restart: 0 Cached devices that were not seen this restart: 0

CAuguston commented 4 years ago

Seems to be working fine even with the message.

Zacknetic commented 4 years ago

@CAuguston Hi, just to confirm, the devices are RGB strip controllers (4 pins: Red, Green, Blue, Ground)? I'll add it to the next update to remove that pesky message.

The colors are correctly working? i.e. setting to red doesn't make the light green?

macadamer commented 4 years ago

I have the same issue. The colours do change correctly.

Incidentally, it's "simultaneous" in the plugin, sorry for the carp!

Zacknetic commented 4 years ago

@macadamer Those settings have no effect on controllers which have no white settings. Could you please post a homebridge log and a link to your controllers?

macadamer commented 4 years ago

The update I installed today has cleared the extraneous log entries, many thanks!

For the record, the bulbs I have are these: https://www.banggood.com/ZJ-WFBJ-RGBWW-E27-WiFi-Smart-LED-Bulb-9W-RGBCW-App-Control-Work-With-Alexa-Google-Assistant-AC100-240V-p-1600820.html

macadamer commented 4 years ago

I spoke too soon. I had to restore Homebridge from a backup, updated MagicHome to the latest version and got the below. I followed the steps given above which didn't clear the errors. There are two of the RGBWW bulbs, the one titled "Left Light" seems to be OK.

[10/4/2020, 14:21:45] Homebridge v1.2.3 is running on port 51420. [10/4/2020, 14:21:47] [homebridge-magichome-dynamic-platform] Discovered 2 devices.

[10/4/2020, 14:21:47] [homebridge-magichome-dynamic-platform] Registering cached accessory 'Left Light' Model: 'AK001-ZJ2101' Unique ID: '2CF432CEA47A' IP-Address: '192.168.1.120' Version 7 Version Modifier: 53

[10/4/2020, 14:21:47] [homebridge-magichome-dynamic-platform] TypeError: Cannot read property 'controllerType' of undefined at HomebridgeMagichomeDynamicPlatform.discoverDevices (/usr/local/lib/node_modules/homebridge-magichome-dynamic-platform/src/platform.ts:308:94) at processTicksAndRejections (internal/process/task_queues.js:97:5) [10/4/2020, 14:21:47] [homebridge-magichome-dynamic-platform] Warning! Continuing to register cached accessory 'Right Light' despite not being seen for 5 restarts. Model: 'AK001-ZJ2101' Unique ID: '2CF432CEA3F8' IP-Address: '192.168.1.39' Version 7 Version Modifier: 53

Zacknetic commented 3 years ago

@macadamer @CAuguston

I have come up with a new version of the plugin that should solve this issue.

Please update your plugin to version 1.5.1 . Note: if you are updating from version 1.4.x you'll need to purge all your magichome devices after updating. Then restart homebridge to rescan.

With help, I found a bug in the code that caused duplicate device to register if the user had multiple subnets. Thus the crash. I was trying to scan on more than one subnet but didn't account for devices showing up on more than one.

Let me know how it goes. Thank you.

macadamer commented 3 years ago

Fingers firmly crossed, updated as requested and all seems good :-)

Thank you for working on this!

--

Cheers

Derryck

On 29 Oct 2020, at 23:48, Zacknetic notifications@github.com wrote:

@macadamer @CAuguston

I have come up with a new version of the plugin that should solve this issue.

Please update your plugin to version 1.5.1 . Note: if you are updating from version 1.4.x you'll need to purge all your magichome devices after updating. Then restart homebridge to rescan.

With help, I found a bug in the code that caused duplicate device to register if the user had multiple subnets. Thus the crash. I was trying to scan on more than one subnet but didn't account for devices showing up on more than one.

Let me know how it goes. Thank you.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

Zacknetic commented 3 years ago

@macadamer very glad to hear it. @CAuguston closing this for now, please reopen if you are still finding issues.