Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error getting devices: TypeError: Cannot read property 'filter' of undefined #87

Closed
KCFT23 opened this issue Jun 8, 2020 · 16 comments
Closed
Labels
bug Something isn't working

Comments

@KCFT23
Copy link

KCFT23 commented Jun 8, 2020

I updated to 2.7.1 today and I am getting the following error when trying to load my bond device: "Error getting devices: TypeError: Cannot read property 'filter' of undefined"

I have tried the usual steps: rolling back the plugin, stopping and restarting homebridge, reinstalling the plugin, removing the device and files in "persist", etc. I still get the same error after trying to add the device. Please let me know if you have any suggestion.

  • Plugin version 2.7.1
  • Bond firmware version 2.10.12
@KCFT23 KCFT23 added the bug Something isn't working label Jun 8, 2020
@KCFT23
Copy link
Author

KCFT23 commented Jun 8, 2020

Some more info...
I turned on "debug" and I can see there is communication between homebridge and the bond device. It successfully finds the device, but the error seems to happen when it is reading its properties. My device responds with the following properties:
{"max_speed":6,"feature_light":true,"feature_brightness":true,"breeze_max_speed":6,"breeze_min_speed":1,"breeze_period":30,"_":"NNNNNNll"}
Note: I masked the last one because I am not sure if it is sensitive.

That is when the "Error getting devices: TypeError: Cannot read property 'filter' of undefined" error happens. Apparently it is not understanding one of those properties?

Thanks

@bnowacky
Copy link

bnowacky commented Jun 8, 2020

I'm having the same results:

  • Plugin 2.7.1
  • Firmware 2.10.12
  • Homebridge 1.1.0

Logs:
/v2/devices/1] - {"name":"ceiling fan","location":"Office","type":"CF","actions":["TurnOn","TurnOff","TogglePower","SetSpeed","IncreaseSpeed","DecreaseSpeed","TurnLightOn","TurnLightOff","ToggleLight","SetBrightness","IncreaseBrightness","DecreaseBrightness","CycleBrightness","SetTimer","BreezeOn","BreezeOff","SetBreeze"],"":"7a5ba0fc","state":{"":"c7c44457"},"properties":{"":"a10fcd96"},"addr":{"":"XXXXX"}}

[get /v2/devices/1/properties] - {"max_speed":4,"feature_light":true,"feature_brightness":true,"breeze_max_speed":3,"breeze_min_speed":1,"breeze_period":30,"_":"a10fcd96"}

After /properties, it throws the error:
Error getting devices: TypeError: Cannot read property 'filter' of undefined

@KCFT23
Copy link
Author

KCFT23 commented Jun 8, 2020

ok, I thought rolling back did not help. However, when I rolled back to 2.6.0 it works fine. So apparently it broke with 2.7.0. I will keep using 2.6.0 until there is a fix. Thanks

@othrside
Copy link

othrside commented Jun 9, 2020

Same issue

@aarons22
Copy link
Owner

aarons22 commented Jun 9, 2020

Sorry about that! I can't reproduce locally but attempted to fix this in 2.7.2. If that doesn't work, I will need more detailed logs with homebridge -D so I can see if there was something else happening around the time the error is thrown.

@patgmac
Copy link

patgmac commented Jun 9, 2020

I'm getting the same error as well, with 2.7.2.
I'm not sure how to get the detailed logs, as "homebridge -D" seems to run an old HB config for me.

@bnowacky
Copy link

bnowacky commented Jun 9, 2020

No luck on update. The results I posted previously were all that was output to logs with -D enabled in homebridge. Not a lot of additional info.

I’m guessing it’s just trying to iterate over the array before it’s set somewhere, which is why it’s undefined, but that’s just a guess.

@aarons22
Copy link
Owner

aarons22 commented Jun 9, 2020

Thanks all - I've got a family wedding this weekend so I won't be able to look at this until sometime next week at the earliest. Please use 2.6.0 for now if you are having issues!

@knavabi
Copy link

knavabi commented Jun 10, 2020

I have the same issue on 2.7.2 after updating!

The copy of log:
[6/10/2020, 1:42:29 PM] [Bond] 0 cached accessories were loaded
[6/10/2020, 1:42:29 PM] [Bond] Getting devices...
[6/10/2020, 1:42:29 PM] [Bond] 1 devices were found on this Bond.
[6/10/2020, 1:42:29 PM] [Bond] Attempting to add 1 devices that were not previously added.
[6/10/2020, 1:42:29 PM] [Bond] Error getting devices: TypeError: Cannot read property 'filter' of undefined

@aarons22
Copy link
Owner

@knavabi can you run homebridge in debug mode and post your logs? (homebridge -D)

@knavabi
Copy link

knavabi commented Jun 15, 2020

@knavabi can you run homebridge in debug mode and post your logs? (homebridge -D)

@aarons22 Here you are:
[6/15/2020, 1:32:59 PM] [Bond] Configuring Accessory: Master Bedroom
[6/15/2020, 1:32:59 PM] TypeError: Cannot read property 'filter' of undefined
at Object.fanSpeeds (/usr/lib/node_modules/homebridge-bond/dist/interface/Device.js:68:14)
at BondPlatform.setupFanObservers (/usr/lib/node_modules/homebridge-bond/dist/platform.js:279:40)
at BondPlatform.setupObservers (/usr/lib/node_modules/homebridge-bond/dist/platform.js:129:30)
at Timeout._onTimeout (/usr/lib/node_modules/homebridge-bond/dist/platform.js:112:26)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
ERROR: uncaughtException: Cannot read property 'filter' of undefined
TypeError: Cannot read property 'filter' of undefined
at Object.fanSpeeds (/usr/lib/node_modules/homebridge-bond/dist/interface/Device.js:68:14)
at BondPlatform.setupFanObservers (/usr/lib/node_modules/homebridge-bond/dist/platform.js:279:40)
at BondPlatform.setupObservers (/usr/lib/node_modules/homebridge-bond/dist/platform.js:129:30)
at Timeout._onTimeout (/usr/lib/node_modules/homebridge-bond/dist/platform.js:112:26)
at listOnTimeout (internal/timers.js:549:17)
at processTimers (internal/timers.js:492:7)
INFO: INFO: Your plugin version is up-to-date
NOTICE: Sending Plugin Status to SmartThings | UpdateAvailable: false | newVersion: 2.3.4

@knavabi
Copy link

knavabi commented Jun 15, 2020

@knavabi can you run homebridge in debug mode and post your logs? (homebridge -D)

It is working competently fine when downgraded to v2.6.0.

@aarons22
Copy link
Owner

Thank you this is super helpful! Seeing the files / line where it's happening makes it very easy to debug

@aarons22
Copy link
Owner

@knavabi I appreciate the logs, it was a lot easier to track down. I'm hoping 2.7.3 fixes the issue!

@bnowacky
Copy link

Just updated and looks like it's working. At least it was a simple update, and null vs. undefined is the reason Javascript is such a hated language :)

Thanks @aarons22 ! !

@KCFT23
Copy link
Author

KCFT23 commented Jun 19, 2020

thank you! it works fine now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants