Rebuilding the Nest plugin

For heating/cooling related questions in Domoticz

Moderator: leecollings

poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

dotms wrote:Nest throwing a 307 redirect either means:
  • There is some maintenance happening at their side. That should be transient and resolve itself.
  • You hit some rate limit. This can be fixed by polling less frequently.
The latter case which is something that needs to be changed in the plugin. Unfortunately for us Nest does not tell us the actual limits (except that you have crossed the limit) so it remains a guess what a good interval is.
Where in the plugin can I change the rate frequency? And does the normal login password no limit?


Verzonden vanaf mijn iPhone met Tapatalk Pro
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
dotms
Posts: 29
Joined: Monday 01 May 2017 22:52
Target OS: Linux
Domoticz version: git
Location: Netherlands
Contact:

Re: Rebuilding the Nest plugin

Post by dotms »

Not too sure about the behavior of the mobile API. Chances are that one does not enforce rate limiting since it's not an official API anyway and Nest never bothered to implement rate limiting? But to be frank: I just don't know.

The polling interval is currently not user configurable. But in the code it's in hardware/NestOAuthAPI.cpp line 78:

Code: Select all

#define NEST_POLL_INTERVAL 30
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

dotms wrote:Not too sure about the behavior of the mobile API. Chances are that one does not enforce rate limiting since it's not an official API anyway and Nest never bothered to implement rate limiting? But to be frank: I just don't know.

The polling interval is currently not user configurable. But in the code it's in hardware/NestOAuthAPI.cpp line 78:

Code: Select all

#define NEST_POLL_INTERVAL 30
Thanks for the info. Let's hope when I change it and there is smoke it will not wait for the interval before you see it in Domoticz.... Haha 1 minute interval means full burned house before update device in Domoticz haha


Verzonden vanaf mijn iPhone met Tapatalk Pro
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

this is what i can find on NEST Developers website:
So one call per minute max
Per access token limits
Each access token also has an associated rate limit. Establishing connections to the service incurs some overhead, so we limit the number of connections a product can make in a specific time period.

For REST and REST streaming calls, each access token has a limited number of calls. Data rate limits apply to read/write calls via REST, and on read calls via REST streaming. To avoid errors, we recommend you limit requests to one call per minute, maximum.
And those error explanation
Error response
When using REST or REST streaming, you will receive a response code of 429 Too Many Requests.

Handling 307 redirects
When making REST or REST streaming calls, your product will need to handle 307 redirects. Also known as URL forwarding, a 307 Temporary Redirect response provides a new URL for the browser to resubmit a request.

When a 307 redirect happens, you'll need to make the call again with the new URL information. When you do this, you should cache the host and port number for use in future calls with that user/access token. Remember, each call counts toward the rate limit. Consider how your user is interacting with your product. Some users will press a button or choose a setting repeatedly, so if you make a call for every user action, it can impact rate limits very quickly. If a user makes a series of changes in rapid succession, you should only make an API call for the last (most recent) value.

For more information and an example, see How to Handle Redirects.

After 307 redirect
If you are using the redirect URL information and get a 307 redirect at a later time, you should follow that redirect.

Connection error
If you are using the cached URL information and get a connection error (due to host out of service or site down), you should revert to the original base URL.
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
jarr
Posts: 3
Joined: Friday 29 June 2018 5:04
Target OS: Linux
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by jarr »

The 30 second interval seems to be too short when you're not using the simulator.
I think the interval should be changed to 60 seconds (even though that's not ideal for Protect...). I get no errors at a 60s interval, but toooooons at 30s. Sometimes it won't pull an update for 30 minutes because of the rate limiter which is far worse than waiting 1 minute for an update...
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

What will happen if Protect react on spoke or CO. Will we have wait also 1 minute before Domoticz will be updated?
Or will send NEST a request to update the device directly?
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
jarr
Posts: 3
Joined: Friday 29 June 2018 5:04
Target OS: Linux
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by jarr »

Based on how this plugin works, it has to poll the status of devices, so you would have to wait up to 1 minute to know your Protect has been triggered. The plugin would have to re-written again to use the Rest Streaming API or Firebase API to be able to receive realtime changes in devices...
simon_rb
Posts: 612
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Rebuilding the Nest plugin

Post by simon_rb »

Is this being worked on? I can't seem to get either Nest Plugins working on Stretch with latest stable build.

The original plugin worked just fine until Stretch and it seems to be something with that. It now just says Nest Error Login.

The OAuth version comes up with the 307 redirect and token invalid; this happened straight away and not after a few hours so I assume its not too many hits.

Any help would be greatly accepted.

Many Thanks
morilm
Posts: 35
Joined: Friday 27 January 2017 12:57
Target OS: OS X
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by morilm »

Dear all

I have been able to setup the plugin by following the wiki...

2018-10-15 18:30:43.088 NestOAuthAPI: Access token appears to be valid.
2018-10-15 18:30:43.089 NestOAuthAPI: Login success. Token successfully validated.

I haven't any timeout or api issue for now... but will keep the eye on it to determine if there is any limit on the number of calls due to the 30 seconds. I use only for temperature control so I don't need real time.

However, I have seen an small issue with the C/F conversion. If nest thermostat is set to F, the information received in domotirz is shown as C. If domoticz units are to F, the conversion is done but using the wrong parameters.

Not sure if the plugin in missing to tell domoticz the provided temp is F/C or the plugin needs to convert received temp from the thermostat to C if unit is set to F...

Thanks for the support...

Regards,
Miguel
morilm
Posts: 35
Joined: Friday 27 January 2017 12:57
Target OS: OS X
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by morilm »

Hi

After two days, I do confirm plugin sometimes is not able to connect


2018-10-17 07:07:54.191 (Nest) Temp + Humidity
2018-10-17 07:08:26.964 Error: NestOAuthAPI: Error getting devices!
2018-10-17 07:08:56.966 NestOAuthAPI: Trying to access API on https://developer-api.nest.com/structur ... th=xxxxxxx
2018-10-17 07:08:58.294 NestOAuthAPI: Access token appears to be valid.
2018-10-17 07:08:58.295 NestOAuthAPI: Login success. Token successfully validated.
2018-10-17 07:08:59.554 Error: NestOAuthAPI: Error getting structures!
2018-10-17 07:09:29.556 NestOAuthAPI: Trying to access API on https://developer-api.nest.com/structur ... auth=xxxxx
2018-10-17 07:09:30.883 NestOAuthAPI: Access token appears to be valid.
....
2018-10-17 07:22:04.289 Error: NestOAuthAPI: Error getting devices!

So seems to be either a problem of too much request to Nest API as the plugin is continuously connecting to Nest. Maybe a timer on the preferences will help to reduce the amount of request, even for cameras and skmoke detectors it might be required this continuous update).

regards
Miguel
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

Hi All

Yesterday i post problems in a treat. Read my posts. Its something with beta versions of Domoticz

viewtopic.php?f=14&t=25494&p=196131&hilit=nest#p196131
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

Hi All,

Yesterday i had a little accident with a candle. My Smoke Sensor went off in living room. Everything ok. House is still there.
But NO data or signal from Domoticz Device of NEST Smoke Device......

So this is not working ok.....
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

:(

I revert back to:

Version: 4.10049
Build Hash: 098a95eb
Compile Date: 2018-10-08 13:22:42
dzVents Version: 2.4.7
Python Version: 3.6.4 (default, Oct 10 2018, 09:47:26) [GCC 6.3.0 20170516]

Because the NEST errors are still there even after latest beta update.
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

Does somebody have using latest BETA (Version #10228) moment of writing, where all the NEST errors are solved?
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Upper78
Posts: 5
Joined: Tuesday 28 March 2017 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10228
Contact:

Re: Rebuilding the Nest plugin

Post by Upper78 »

poudenes wrote: Sunday 25 November 2018 3:43 Does somebody have using latest BETA (Version #10228) moment of writing, where all the NEST errors are solved?
Just installed it, and at least the update frequency has changed to over 1 minute:

Code: Select all

2018-11-25 11:24:04.521 (Nest OAuth) Thermostat (Woonkamer Setpoint)
2018-11-25 11:24:04.527 (Nest OAuth) Temp + Humidity (Woonkamer TempHum)
2018-11-25 11:25:08.583 (Nest OAuth) Thermostat (Woonkamer Setpoint)
2018-11-25 11:25:08.587 (Nest OAuth) Temp + Humidity (Woonkamer TempHum)
So it looks good, let's hope the errors keep away.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

Can you keep it in scope and post here after some days if errors come back or not?


Verzonden vanaf mijn iPhone met Tapatalk Pro
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Furry
Posts: 31
Joined: Sunday 19 February 2017 15:03
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: UK
Contact:

Re: Rebuilding the Nest plugin

Post by Furry »

poudenes wrote: Sunday 25 November 2018 3:43 Does somebody have using latest BETA (Version #10228) moment of writing, where all the NEST errors are solved?
I have installed it, but still no Nest login.
Raspberry Pi 3; Domoticz 2022.2
Philips Hue, Logitech Harmony Elite, LMS, Drayton Wiser
Rfxtrx433e and Owl CM11x
Aeon Z-Stick Gen 5
Dark Skies
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

OK sounds good. Maybe I gonna test it myself when I'm off work whole day haha


Verzonden vanaf mijn iPhone met Tapatalk Pro
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Upper78
Posts: 5
Joined: Tuesday 28 March 2017 11:59
Target OS: Raspberry Pi / ODroid
Domoticz version: V4.10228
Contact:

Re: Rebuilding the Nest plugin

Post by Upper78 »

poudenes wrote: Sunday 25 November 2018 12:26 Can you keep it in scope and post here after some days if errors come back or not?


Verzonden vanaf mijn iPhone met Tapatalk Pro
Day later, and still no errors.
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes »

Since this morning also NEST with OAuth login way and no errors
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest