node-red-contrib-nora icon indicating copy to clipboard operation
node-red-contrib-nora copied to clipboard

Connection closing occasionally

Open mvujica opened this issue 4 years ago • 9 comments

Thx for this great project, looking for something like this for my rpi automation for a long time. Occasionally I get connection problems from Google Assistant to NORA; been checking it regularly now and had 2 failures in 4 days (averages one in 48h), if I update nora-config node and deploy flow everything starts working normally again. Is there an issue on the backend and is there a way to create some sort of watchdog to reset the connection? I really hate the idea to reset node manually every few days; it beats the point of remote control. Thanks again. Marko.

mvujica avatar Mar 19 '20 09:03 mvujica

Service restarts once a day so the connection should drop at a 24h average (it's how heroku works https://devcenter.heroku.com/articles/dynos#automatic-dyno-restarts).

The Node-red plugin retries connection automatically when connection breaks but might take some time depending on the load on nora.

Any relevant nora output logs from node-red?

andrei-tatar avatar Mar 19 '20 09:03 andrei-tatar

Thanks for a really quick response... There is one error (nora: sync error (invalid object for sync)):

pi@raspberrypi:~ $ node-red-log


16 Mar 07:55:54 - [info] nora (212zE): connected
16 Mar 07:55:55 - [info] nora: sync 11 devices
17 Mar 03:06:19 - [warn] nora (212zE): disconnected (transport close)
17 Mar 03:06:28 - [info] nora (212zE): connected
17 Mar 03:06:29 - [info] nora: sync 11 devices
17 Mar 07:15:00 - [error] [function:Dohvati Dubrovnik-aerodrom] TypeError: Cannot read property 'length' of undefined
18 Mar 03:15:03 - [warn] nora (212zE): disconnected (transport close)
18 Mar 03:15:12 - [info] nora (212zE): connected
18 Mar 03:15:13 - [info] nora: sync 11 devices
18 Mar 21:46:11 - [info] [IKEA: 2961864d.e6079a] LightOp '{"transitionTime":0.1,"onOff":true}' unsuccessful, 'Error: Retransmit counter exceeded'
19 Mar 03:44:23 - [warn] nora (212zE): disconnected (transport close)
19 Mar 03:44:32 - [info] nora (212zE): connected
19 Mar 03:44:33 - [info] nora: sync 11 devices
19 Mar 03:44:34 - [warn] nora: sync error (invalid object for sync)
19 Mar 07:15:00 - [error] [function:Dohvati Dubrovnik-aerodrom] TypeError: Cannot read property 'length' of undefined
19 Mar 09:37:16 - [info] Stopping flows
19 Mar 09:37:16 - [info] nora (212zE): close connection
19 Mar 09:37:16 - [warn] nora (212zE): disconnected (io client disconnect)
19 Mar 09:37:16 - [info] Stopped flows
19 Mar 09:37:16 - [info] Starting flows
19 Mar 09:37:16 - [info] nora (212zE): connecting
19 Mar 09:37:16 - [info] Started flows
19 Mar 09:37:17 - [info] nora (212zE): connected
19 Mar 09:37:18 - [info] nora: sync 11 devices
19 Mar 09:37:46 - [error] [function:Dohvati Dubrovnik-aerodrom] TypeError: Cannot read property 'length' of undefined

When I logged in node-red around 9:30 today all nora nodes were connected and displayed right status, is it google to server side problem?

mvujica avatar Mar 19 '20 10:03 mvujica

I have the same problem. I have to change the token in the NORA config node for the new one generated in node-red-google-home.herokuapp.com.

Why the token changes every day? Is there a way to update the NORA config node automatically with the new token?

Alternatively, how can we mount a server like the one that you mounted in heroku?

luxarts avatar Mar 20 '20 20:03 luxarts

I can confirm that as of 18th of March I had no issues with NORA connection, service restarts once per day but reconnects successfully. Should we close this?

mvujica avatar Mar 24 '20 15:03 mvujica

I can confirm that as of 18th of March I had no issues with NORA connection, service restarts once per day but reconnects successfully. Should we close this?

I'm still having problems. Every day the token changes and I have to update it in the NORA config node. In other hand, every time I access to the NORA's heroku website to get the new token it ask me to login again (using Google account). I don't know if that can be the problem.

Thanks!

luxarts avatar Mar 24 '20 22:03 luxarts

Every day the token changes and I have to update it in the NORA config node.

Token changes every login. That doesn't mean you have to update it. It's because of how signing works.

In other hand, every time I access to the NORA's heroku website to get the new token it ask me to login again (using Google account).

Because the cookie expires after a few hours.

andrei-tatar avatar Mar 25 '20 10:03 andrei-tatar

Token changes every login. That doesn't mean you have to update it. It's because of how signing works.

When I log in again, the device list is empty. I have to update the token in Node-RED to get the device list again. Also, the Google Home app and Assistant shows/tells me that the devices aren't available.

luxarts avatar Mar 26 '20 05:03 luxarts

19 Mar 03:44:34 - [warn] nora: sync error (invalid object for sync)

This means that on restart your devices are not synced. It works when you update the token because on restart they don't have invalid properties. They probably get set via some other messages. If you have thermostats, make sure the humidity is 0-100. Same for the brightness for lights.

andrei-tatar avatar Mar 26 '20 07:03 andrei-tatar

Still getting occasional nora: sync error (invalid object for sync) and flow stops updating google servers. I guess it's client-side problem, could you add more logging on nora nodes? I did patch it by automatic flow restart every day but feels like a hack, I would like to get to bottom of this. Thanks again for nice work! M.

mvujica avatar Apr 01 '20 09:04 mvujica