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

[Netatmo] Rest call failed: statusCode=MAXIMUM_USAGE_REACHED #13358

Closed
jp-Ll opened this issue Sep 6, 2022 · 17 comments · Fixed by #13489
Closed

[Netatmo] Rest call failed: statusCode=MAXIMUM_USAGE_REACHED #13358

jp-Ll opened this issue Sep 6, 2022 · 17 comments · Fixed by #13489
Assignees
Labels
bug An unexpected problem or unintended behavior of an add-on

Comments

@jp-Ll
Copy link

jp-Ll commented Sep 6, 2022

I have the following Netatmo devices in my OH3.3 system:

  • 6 Netatmo cameras (5x Presence, 1x Welcome),
  • Video Doorbell and
  • Netatmo Weather Station (1x indoor, 1x outdoor, wind, rain)

Reconnect Interval for Netatmo Account is set to 600.

There are warnings in the log saying I have reached the maximum user usage:

2022-09-06 09:38:51.368 [WARN ] [al.handler.capability.HomeCapability] - Error gettting Home informations : Rest call failed: statusCode=MAXIMUM_USAGE_REACHED, message=User usage reached
2022-09-06 09:38:51.440 [WARN ] [andler.capability.SecurityCapability] - Error retrieving last events of camera '70:ee:50:6f:xx:xx' : Rest call failed: statusCode=MAXIMUM_USAGE_REACHED, message=User usage reached
[same message for the other 5 cameras]
2022-09-06 09:45:21.369 [WARN ] [handler.capability.WeatherCapability] - Error retrieving weather data '70:ee:50:17:yy:yy' : Rest call failed: statusCode=MAXIMUM_USAGE_REACHED, message=User usage reached

Regardless of the warnings, the Binding/Things/Channel/Items work properly.

Are there any parameters to limit the number or the interval of Rest calls so that the maximum usage limit will not be reached?

Many thanks for your help!

Kind regards,
Joachim


openHAB 3.3.0 Release Build
Netatmo binding 3.3.0
Raspberry / Linux/5.10.103-v7l+ (arm)
Java Raspbian 11.0.16

@lolodomo lolodomo added bug An unexpected problem or unintended behavior of an add-on and removed documentation labels Sep 7, 2022
@MrMontesa
Copy link

MrMontesa commented Sep 18, 2022

Same here. But for me it just started on 17th sept. Checked logs from beginning of July

swa@nuc:/var/log/openhab$ ls -al openhab.log*
-rw-r--r-- 1 openhab openhab    17518 Sep 18 12:16 openhab.log
-rw-r--r-- 1 openhab openhab    13217 Jul 28 21:18 openhab.log.1.gz
-rw-r--r-- 1 openhab openhab    54602 Aug 10 12:43 openhab.log.2.gz
-rw-r--r-- 1 openhab openhab     9306 Aug 10 21:29 openhab.log.3.gz
-rw-r--r-- 1 openhab openhab    11571 Aug 12 12:23 openhab.log.4.gz
-rw-r--r-- 1 openhab openhab   116862 Sep 12 14:08 openhab.log.5.gz
-rw-r--r-- 1 openhab openhab    21171 Sep 16 15:28 openhab.log.6.gz
-rw-r--r-- 1 openhab openhab    46611 Sep 18 12:12 openhab.log.7.gz
-rw-r--r-- 1 root    root    76830720 Jan 20  2021 openhab.logs.20200120.tar
swa@nuc:/var/log/openhab$ zcat openhab.log.*.gz |grep MAXIMUM_USAGE_REACHED | cut -d " " -f1 | sort -u
2022-09-17
2022-09-18
swa@nuc:/var/log/openhab$ grep MAXIMUM_USAGE_REACHED openhab.log
2022-09-18 12:13:27.746 [WARN ] [handler.capability.WeatherCapability] - Error retrieving weather data '70:ee:50:65:57:06' : Rest call failed: statusCode=MAXIMUM_USAGE_REACHED, message=User usage reached
2022-09-18 12:13:27.854 [WARN ] [al.handler.capability.HomeCapability] - Error gettting Home informations : Rest call failed: statusCode=MAXIMUM_USAGE_REACHED, message=User usage reached

Similar setup: OH3.3.0 Release with release Netatmo binding running on debian x86_64 host.
The MAC from the error message is my Netatmo indoor station.
Let me know if I can be of any help troubleshooting.

Thanks Sebastian

@lolodomo
Copy link
Contributor

lolodomo commented Oct 3, 2022

@clinique : does Netatmo communicate on what are the API limits?

We could have a counter of the requests in the last hour, and show it in a channel?
This could help to understand how many requests were done when the user reached the limit.

@clinique
Copy link
Contributor

clinique commented Oct 3, 2022

I found some elements here :
Per user limits

50 requests every 10 seconds
500 requests every hour

This means 8 requests per minute in average as a limit. I think this can be reached quite easily. We'll have to see how to be cautious on this.

@lolodomo
Copy link
Contributor

lolodomo commented Oct 3, 2022

This means 8 requests per minute in average as a limit. I think this can be reached quite easily. We'll have to see how to be cautious on this.

Oh yes, especially if you own several devices.
Look at how many devices @jp-Ll declares.

@clinique
Copy link
Contributor

clinique commented Oct 4, 2022

Yes, I suspect it's the getEvents request of security modules and persons that may multiply the number of requests. I'm going to take a look at this.

clinique added a commit to clinique/openhab-addons that referenced this issue Oct 4, 2022
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves openhab#13358

Signed-off-by: clinique <gael@lhopital.org>
@lolodomo
Copy link
Contributor

lolodomo commented Oct 6, 2022

In complement to @clinique PR that reduces the number of requests, I propose to create another PR that will allow the user to monitor the number of requests executed during the last hour. The chance is that any executed request is finally handled by a unique method in the code and this method is even localized in the bridge handler. As a consequence, it will be very easy to implement that feature through an advanced new channel, that is probably just few lines of new code.

@lolodomo
Copy link
Contributor

lolodomo commented Oct 6, 2022

that is probably just few lines of new code

I thought I will do it in 10 minutes but ... no.
Unfortunately, this is not so easy because there is no more thing static definition (something very unusual - probably the only binding doing that at this level), everything is built dynamically in that binding, even the thing definition. Just adding a channel becomes not so easy.

@clinique
Copy link
Contributor

clinique commented Oct 6, 2022

that is probably just few lines of new code

I thought I will do it in 10 minutes but ... no. Unfortunately, this is not so easy because there is no more thing static definition (something very unusual - probably the only binding doing that at this level), everything is built dynamically in that binding, even the thing definition. Just adding a channel becomes not so easy.

I'll do it if you want.

lolodomo pushed a commit that referenced this issue Oct 7, 2022
* Buffer last event requests per child modules
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves #13358

Signed-off-by: clinique <gael@lhopital.org>
@lolodomo
Copy link
Contributor

lolodomo commented Oct 9, 2022

For information, with the new monitoring channel, I can see that I was before at an average of 103 requests per hour and now with the different improvements I am now at around 82 requests per hour' with my setup.
@jp-Ll and @MrMontesa : will be interesting that you retry with the coming new 3.4 milestone.

@clinique
Copy link
Contributor

clinique commented Oct 9, 2022

Minus 20%. Not that bad ! Thanks for reporting @lolodomo

@lolodomo
Copy link
Contributor

lolodomo commented Oct 9, 2022

What value do you get @clinique with your own setup ?

I have now blocks of 3 requests, rather than 4 before.

PS: note that it is when running snapshot built last night, so not with the last fix.

@clinique
Copy link
Contributor

clinique commented Oct 9, 2022

This means that the event is served by the buffer instead of issuing a dedicated request.
I just installed latest milestone in production this morning. Will give you a feed-back when I'll have a bit of history.

@lolodomo
Copy link
Contributor

lolodomo commented Oct 9, 2022

Note that my home refresh interval is set to 150s, rather than the default 180s.
The problem could be reached by users setting this interval at a too much small value. @jp-Ll and @MrMontesa : did you update that setting or did you keep the default 180s ?

@MrMontesa
Copy link

Hey guys,
Thanks for investigating this issue. Currently I dont have any of the messages in my log, but I have to admit that the battery of my rain sensor drained and the thing is offline. This might reduce API calls as well.
My update interval is the default with 180s.

Will test the new milestone as soon as the Shelly DEV merged some buxfixes, so I can test both.
Thanks for your help.

@lolodomo
Copy link
Contributor

@clinique : did you check how many requests you generate ?
Here is how it behaves for me:
image

@clinique
Copy link
Contributor

Mine look like this :
image

Highest 140. Usually around 120 per hour.

@lolodomo
Copy link
Contributor

For documentation, the 3 requests occurring at each refresh for security stuff: homesdata, homestatus and getevents.
Question to @clinique: is the homesdata request really needed ? It looks like the homestatus request retrieves almost all the data from the other request.

andan67 pushed a commit to andan67/openhab-addons that referenced this issue Nov 6, 2022
* Buffer last event requests per child modules
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves openhab#13358

Signed-off-by: clinique <gael@lhopital.org>
andrasU pushed a commit to andrasU/openhab-addons that referenced this issue Nov 12, 2022
* Buffer last event requests per child modules
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves openhab#13358

Signed-off-by: clinique <gael@lhopital.org>
Signed-off-by: Andras Uhrin <andras.uhrin@gmail.com>
borazslo pushed a commit to borazslo/openhab-mideaac-addon that referenced this issue Jan 8, 2023
* Buffer last event requests per child modules
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves openhab#13358

Signed-off-by: clinique <gael@lhopital.org>
psmedley pushed a commit to psmedley/openhab-addons that referenced this issue Feb 23, 2023
* Buffer last event requests per child modules
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves openhab#13358

Signed-off-by: clinique <gael@lhopital.org>
nemerdaud pushed a commit to nemerdaud/openhab-addons that referenced this issue Feb 28, 2023
* Buffer last event requests per child modules
This is targetted to decrease the number of requests transmitted to Netatmo API.
Solves openhab#13358

Signed-off-by: clinique <gael@lhopital.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An unexpected problem or unintended behavior of an add-on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants