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

Cannot read property 'on' of undefined #95

Closed
jojost1 opened this issue Apr 18, 2017 · 11 comments
Closed

Cannot read property 'on' of undefined #95

jojost1 opened this issue Apr 18, 2017 · 11 comments
Labels

Comments

@jojost1
Copy link
Contributor

jojost1 commented Apr 18, 2017

Getting this error since the latest update, in two different homes, on startup.

@jojost1
Copy link
Contributor Author

jojost1 commented Apr 18, 2017

Also: it reports '0 accessories' and just deleted my motion sensor..

@jojost1
Copy link
Contributor Author

jojost1 commented Apr 18, 2017

Powering off the Bridge does not give any errors in the Homebridge window.

@ebaauw
Copy link
Owner

ebaauw commented Apr 18, 2017

Did you specify the bridge as host In config.json? Does it still have the same IP address?

Could you please list the output of homebridge -D?

@jojost1
Copy link
Contributor Author

jojost1 commented Apr 18, 2017

@ebaauw I did, and it still has. Output:

[2017-4-18 15:22:14] [Hue] 192.168.1.4: hue bridge request #1: ok
[2017-4-18 15:22:14] [Hue] Cannot read property 'on' of undefined
[2017-4-18 15:22:14] [Hue] Bridge Joost: 0 accessories

@ebaauw
Copy link
Owner

ebaauw commented Apr 18, 2017

Please list the full debug output, incl. version numbers, requests, etc.

It would seem Homebridge-hue did at least get its name from your bridge...

@jojost1
Copy link
Contributor Author

jojost1 commented Apr 18, 2017

Whoops sorry @ebaauw, here's everything:

[2017-4-18 15:22:13] Loaded plugin: homebridge-dummy
[2017-4-18 15:22:13] Registering accessory 'homebridge-dummy.DummySwitch'
[2017-4-18 15:22:13] ---
[2017-4-18 15:22:13] Loaded plugin: homebridge-hue
[2017-4-18 15:22:13] Registering platform 'homebridge-hue.Hue'
[2017-4-18 15:22:13] ---
[2017-4-18 15:22:13] Loaded plugin: homebridge-itunes
[2017-4-18 15:22:13] Registering platform 'homebridge-itunes.iTunes'
[2017-4-18 15:22:13] ---
[2017-4-18 15:22:14] Loaded plugin: homebridge-people
[2017-4-18 15:22:14] Registering platform 'homebridge-people.People'
[2017-4-18 15:22:14] Registering accessory 'homebridge-people.PeopleAccessory'
[2017-4-18 15:22:14] Registering accessory 'homebridge-people.PeopleAllAccessory'
[2017-4-18 15:22:14] ---
[2017-4-18 15:22:14] Loaded config.json with 1 accessories and 3 platforms.
[2017-4-18 15:22:14] ---
[2017-4-18 15:22:14] Loading 3 platforms...
[2017-4-18 15:22:14] [Hue] Initializing Hue platform...
[2017-4-18 15:22:14] [Hue] homebridge-hue v0.3.15, node v7.7.4, homebridge api v2.2
[2017-4-18 15:22:14] [Hue] 192.168.1.4: hue bridge request #1: get /config
[2017-4-18 15:22:14] Initializing People platform...
[2017-4-18 15:22:14] Initializing platform accessory 'Joost'...
[2017-4-18 15:22:14] Initializing platform accessory 'Kiki'...
[2017-4-18 15:22:14] Initializing platform accessory 'Anyone'...
[2017-4-18 15:22:14] Initializing platform accessory 'No One'...
[2017-4-18 15:22:14] WebHook: Started server on port '51828'.
[2017-4-18 15:22:14] Initializing iTunes platform...
[2017-4-18 15:22:14] Loading 1 accessories...
[2017-4-18 15:22:14] [Server Switch] Initializing DummySwitch accessory...
[2017-4-18 15:22:14] [Hue] 192.168.1.4: hue bridge request #1: ok
[2017-4-18 15:22:14] [Hue] Cannot read property 'on' of undefined
[2017-4-18 15:22:14] [Hue] Bridge Joost: 0 accessories
Scan this code with your HomeKit App on your iOS device to pair with Homebridge:

┌────────────┐     
│ 031-45-154 │     
└────────────┘     

[2017-4-18 15:22:14] Homebridge is running on port 51826.

@ebaauw
Copy link
Owner

ebaauw commented Apr 18, 2017

Thanks, @jojost1.

That narrows down where the Cannot read property 'on' of undefined error message comes from, but, frankly, I have no clue what's causing it. I didn't change that part of the code in v0.3.15. What version where you on before the update?

Also: it reports '0 accessories' and just deleted my motion sensor..
Powering off the Bridge does not give any errors in the Homebridge window.

These are consequences of the first error.

My best guess is a somehow corrupted installation. Some longshots:

  • Did you update homebridge-hue through npm? Could you retry

    sudo npm -g install homebridge-hue

  • Did you update homebridge to v0.4.19?
  • Does homebridge-hue report the same error when it's the only plugin enabled in config.json?
  • Is there a reason why you run node v7.7.4? Could you try node v.6.10.2?

@jojost1
Copy link
Contributor Author

jojost1 commented Apr 18, 2017

Thanks for the quick response!

What version where you on before the update?

v0.3.14 if I'm correct.

Did you update homebridge-hue through npm? Could you retry...

Did that and tried it again, didn't help :(

Did you update homebridge to v0.4.19?

I did, before updating homebridge-hue.

Does homebridge-hue report the same error when it's the only plugin enabled in config.json?

Bit difficult to test right now. I have to say I did notice the same exact error in my other home, but there I still had my dimmer switch & tap in HomeKit.
Similarities between both setups: I was setting up homebridge-iTunes, which works. Might be that, but that's pretty weird if the case. Maybe you could test it?

Is there a reason why you run node v7.7.4? Could you try node v.6.10.2?

No specific reason. How to 'downgrade' to stable? Can try that.

Thanks!

@ebaauw
Copy link
Owner

ebaauw commented Apr 18, 2017

v0.3.14 if I'm correct.

And re-installing v0.3.14 gets rid of the error?

I have to say I did notice the same exact error in my other home

"Other home" as in another Hue bridge, another installation of homebridge on a another machine?

but there I still had my dimmer switch & tap in HomeKit.

That would be because you killed homebridge in time? If it's the same error, homebridge would run without homebridge-hue exposing anything, causing HomeKit to delete the accessories.

@jojost1
Copy link
Contributor Author

jojost1 commented Apr 19, 2017

And re-installing v0.3.14 gets rid of the error?

Nope, it looks like I get the error with v0.3.14/15/17.

I have to say I did notice the same exact error in my other home
"Other home" as in another Hue bridge, another installation of homebridge on a another machine?

Yes, another Bridge, another installation of homebridge, on a completely different Mac. Only common denominator I think is the installation of homebridge-iTunes I was messing around with. Homebridge-hue works on the other Mac right now, but that might be because I deleted homebridge-iTunes there.. I think it is likely that plugin causes problems, is that possible?

That would be because you killed homebridge in time? If it's the same error, homebridge would run without homebridge-hue exposing anything, causing HomeKit to delete the accessories.

See above, I think the plugin exposed the accessories after uninstalling homebridge-iTunes and I don't think I get the error right now (in the other home, my own home is still not working!), sorry I'm unclear ;) Thanks.

@ebaauw
Copy link
Owner

ebaauw commented Apr 19, 2017

but that might be because I deleted homebridge-iTunes there.. I think it is likely that plugin causes problems, is that possible?

Sadly, yes. They override Characteristic.prototype.updateValue(), which is scary at best. To make it worse, they break it by failing to return the characteristic for chaining. homebridge-hue tries to register an event handler on the return value of updateValue(), which now is undefined and no longer contains a property (method) on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants