Rebuilding the Nest plugin

For heating/cooling related questions in Domoticz
poudenes
Posts: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes » Wednesday 13 June 2018 21:32

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

dotms
Posts: 28
Joined: Monday 01 May 2017 22:52
Target OS: Linux
Domoticz version: git
Location: Netherlands
Contact:

Re: Rebuilding the Nest plugin

Post by dotms » Wednesday 13 June 2018 21:41

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: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes » Wednesday 13 June 2018 22:45

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

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

Re: Rebuilding the Nest plugin

Post by poudenes » Thursday 14 June 2018 10:08

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

jarr
Posts: 6
Joined: Friday 29 June 2018 5:04
Target OS: Linux
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by jarr » Saturday 30 June 2018 21:39

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: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes » Sunday 01 July 2018 20:21

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

jarr
Posts: 6
Joined: Friday 29 June 2018 5:04
Target OS: Linux
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by jarr » Sunday 01 July 2018 21:41

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: 709
Joined: Wednesday 07 August 2013 19:09
Target OS: -
Domoticz version:
Location: UK
Contact:

Re: Rebuilding the Nest plugin

Post by simon_rb » Saturday 08 September 2018 16:38

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: 38
Joined: Friday 27 January 2017 13:57
Target OS: OS X
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by morilm » Tuesday 16 October 2018 1:55

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: 38
Joined: Friday 27 January 2017 13:57
Target OS: OS X
Domoticz version:
Contact:

Re: Rebuilding the Nest plugin

Post by morilm » Wednesday 17 October 2018 14:27

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: 594
Joined: Wednesday 08 March 2017 10:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: Rebuilding the Nest plugin

Post by poudenes » Thursday 01 November 2018 10:31

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

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

Re: Rebuilding the Nest plugin

Post by poudenes » Wednesday 07 November 2018 16:29

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

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

Re: Rebuilding the Nest plugin

Post by poudenes » Tuesday 13 November 2018 13:47

:(

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 with OSMC - RPi3 with Domoticz - Dashticz - MiLight - Nanolead Aurora - KaKu - Logitech Hamony - Nest - RFLink

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests