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

Homebridge-Nest failed today after working for quite some time. #107

Closed
davidtennant8082 opened this issue Jan 7, 2017 · 26 comments
Closed

Comments

@davidtennant8082
Copy link

I've had home bridge up and running for well over a year now with limited issues. Haven't done much in the way of updating. I tried to reinstall assuming there could be an update since I last did it and the error remains. Checked with the nest developer site and checked the authorization token and set that back up incase that was causing an issue and have checked permissions there. Everything seems fine...

Here is what it is failing with currently...
XserveServer:~ Tennant$ homebridge
[1/6/2017, 11:07:38 PM] Loaded plugin: homebridge-nest
[1/6/2017, 11:07:38 PM] Registering platform 'homebridge-nest.Nest'
[1/6/2017, 11:07:38 PM] ---
[1/6/2017, 11:07:38 PM] Loaded config.json with 0 accessories and 1 platforms.
[1/6/2017, 11:07:38 PM] ---
[1/6/2017, 11:07:38 PM] Loading 1 platforms...
[1/6/2017, 11:07:38 PM] Initializing Nest platform...
[1/6/2017, 11:07:38 PM] Fetching Nest devices.
/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133
this._pipeline.processIncomingMessage(message, callback, context);
^

TypeError: Cannot read property 'processIncomingMessage' of undefined
at instance.processIncomingMessage (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133:19)
at instance._emitMessage (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:442:22)
at instance._emitFrame (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:405:19)
at instance.parse (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:144:18)
at instance.parse (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/client.js:56:58)
at IO.write (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/streams.js:80:16)
at TLSSocket.ondata (_stream_readable.js:528:20)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:146:16)
at TLSSocket.Readable.push (_stream_readable.js:110:10)
at TLSWrap.onread (net.js:523:20)

@tobeychris
Copy link

I am seeing the same thing:

root@HomeBridge3:~ # homebridge
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
[1/7/2017, 1:59:49 AM] Loaded plugin: homebridge-nest
[1/7/2017, 1:59:49 AM] Registering platform 'homebridge-nest.Nest'
[1/7/2017, 1:59:49 AM] ---
[1/7/2017, 1:59:49 AM] Loaded config.json with 0 accessories and 1 platforms.
[1/7/2017, 1:59:49 AM] ---
[1/7/2017, 1:59:49 AM] Loading 1 platforms...
[1/7/2017, 1:59:49 AM] Initializing Nest platform...
[1/7/2017, 1:59:49 AM] Fetching Nest devices.
/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133
    this._pipeline.processIncomingMessage(message, callback, context);
                  ^

TypeError: Cannot read property 'processIncomingMessage' of undefined
    at Extensions.processIncomingMessage (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/node_modules/websocket-extensions/lib/websocket_extensions.js:133:19)
    at Client._emitMessage (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:442:22)
    at Client._emitFrame (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:405:19)
    at Client.parse (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/hybi.js:144:18)
    at Client.parse (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/driver/client.js:56:58)
    at IO.write (/usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/websocket-driver/lib/websocket/streams.js:80:16)
    at TLSSocket.ondata (_stream_readable.js:555:20)
    at emitOne (events.js:96:13)
    at TLSSocket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at TLSSocket.Readable.push (_stream_readable.js:134:10)
    at TLSWrap.onread (net.js:551:20)

@tobeychris
Copy link

I have tried a fresh install of everything, redoing the token process, even making a new product in the Nest API.
If I remove the token then homebridge will fall-back to the legacy API (assuming credentials are there), but then you lose cameras and possibly other functionality,

@emilkwaaitaal
Copy link

Same here. Not working since today. Same error message as the others...

@davidtennant8082
Copy link
Author

Looks like it occurred for some people under issue 106 which was closed as if just started working on its own.
#106

The thought was an issue on Nests end.

@tobeychris
Copy link

I agree. Definitely something on Nest's end. I guess the question is if this is temporary like #106 or a permanent change in their APIv2.

@davidtennant8082
Copy link
Author

I had also tried a complete reinstall before posting. Have it back up and running using the legacy API for the time being.

@digitalkyle
Copy link

only the legacy api seems to be working for me as well. not sure if nest servers or whats up.

@Muzach
Copy link

Muzach commented Jan 8, 2017

Same issue here. If Nest's v2 API has some intermittent failures it would be nice to have this js defensive so it doesn't crash homebridge...

@PencilDH
Copy link

PencilDH commented Jan 8, 2017

Hello I will just add that I am having the same issue, does anyone understand why this is happening? As we all have Dev accounts we could start logging this issue with nest if this is defiantly their problem?

I also second the option to make the script more robust so it doesn't crash the home bridge server... Yesterday I didn't know how to turn off the light at home, I had to go and turn them off using the wall switches, imagine?! 👎

@pedroserano
Copy link
Contributor

+1

@rtoohil
Copy link

rtoohil commented Jan 8, 2017

Interestingly, I can make curl calls and get responses back just fine. I haven't dug into the code enough to understand the difference between the standard read API calls and the calls that the plugin is making, but the API itself seems fine (using the same token that I generated initially during the plugin setup).

One thing I noticed -- the error coming from faye-websocket-node is similar to this issue: faye/faye-websocket-node#38

The firebase that is used by homebridge-nest is v2.3.2, which includes a version of faye-websocket from before that fix. I made that (one-line) fix by hand (rather than upgrading both firebase and faye-websocket), and homebridge started up fine and is working.

So, my guess is that a change has happened on the Nest end with how they handle closing out websocket clients. The older version of faye-websocket doesn't handle this well, returns that error, and that error isn't caught anywhere.

If I get some time later today, I'll put together a quick pull request that updates firebase to a more recent version (which will pull in a more recent version of faye-websocket), but that will require a bit of testing to make sure that the firebase methods haven't changed much between versions.

In the meantime, if you make that one line change, it should get everything back up and running (at least it has for me, at least for the last hour)

@digitalkyle
Copy link

Thank Ryan, it got ride of the error but now it won't go past the fetching nest devices. I believe the websocket is the root cause of this error

@conradhagemans
Copy link

For now I removed the Nest platform in config.json of Homebridge. Homebridge runs again fine.
Hopefully there will be an update of the NPM Nest module.

@PencilDH
Copy link

PencilDH commented Jan 9, 2017

@conradhagemans You can just make it fall back to legacy API by removing the token and it will work as usual no need to remove the whole device!

@smolyneux
Copy link

smolyneux commented Jan 10, 2017

I found upgrading the version of websocket-driver used (similar to @rtoohil ’s suggestion) from 0.5.2 to 0.5.3 solved the issue for me. Running the below commands:

cd /usr/local/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/

sudo rm -rf websocket-driver

cd ../

sudo npm install [email protected] --save

And restarting Homebridge should allow you to continue using the newer API via a token.

@emilkwaaitaal
Copy link

Works indeed again with upgrade of websocket-driver. Thank you Smolyneux!

@davidtennant8082
Copy link
Author

davidtennant8082 commented Jan 10, 2017

Upgrading as per smolyneux worked as well.

I had to edit the config file as to get it to run on the legacy API, I had to remove all but the user name and password, but had just save multiple copies so that was just cut an paste the file in place and load it.

Marked as closed with the solution of updating the websocket-driver!

@simonrb2000
Copy link

Sorry to open this up again but is this working now with the new API after updating the web socket as instructed above? I'm using the legacy API at the moment.

@davidtennant8082
Copy link
Author

It's working with the new API for me as of right now.

@simonrb2000
Copy link

Excellent - thank you. I might update. Out of curiosity what's the difference between the old and new api within HomeKit? Using the Legacy one now for a couple of days and not seen any difference. I know the old API isn't being developed anymore but neither is the new one by looks of it.

Cheers

@Muzach
Copy link

Muzach commented Jan 11, 2017

Thanks @smolyneux! This worked for me too.

@simonrb2000
Copy link

simonrb2000 commented Jan 12, 2017

I have done above steps and it worked for a couple of minutes and its not working.. Please advise if its still working your end..

Cheers

Update:- I run this via forever and I think it times out and tries to restart the script as it takes a while to grab the nest info and finish loading homebridge. I won't use forever lol

@davidtennant8082
Copy link
Author

Still working perfectly post updating websocket-driver.

In the troubleshooting steps originally of nuking and reinstalling everything I now have my two nest protects working with HomeKit too as I was running such an old version of the nest plugin that it only worked with the thermostat prior to the failure.

@rtoohil
Copy link

rtoohil commented Jan 14, 2017

#109

Pull request with working shrinkwrap.

@lnlyssg
Copy link

lnlyssg commented Jan 14, 2017

I tried the websocket-driver fix but now have the same problem as @digitalkyle - homebridge won't start up as it seems to get stuck at the fetching stage. FWIW my websocket-driver module is under /usr/lib/node_modules/homebridge-nest/node_modules/firebase/node_modules/faye-websocket/node_modules/ on Ubuntu if that makes any difference....

@simonrb2000
Copy link

simonrb2000 commented Jan 14, 2017 via email

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

No branches or pull requests