core: ViCare API rate limit exceeded with default scan_interval
The problem
I have nothing else running against the ViCare API and I’m using the default scan_interval
of 60 seconds and still I get throttled every day. This message shows up in the logs:
Vicare API rate limit exceeded: (PyViCareRateLimitError(...), 'API rate limit development portal "e58a75c2-eb4a-48ee-94f6-62475281d509" daily limit exceeded. Max 1450 calls in timewindow. Limit reset at 2022-02-22T00:00:03.615000.')
I tried to increase the interval but since the config is not in YAML anymore there seems to be no way to edit this after the integration was created or am I missing something?
What version of Home Assistant Core has the issue?
2022.2.9
What was the last working version of Home Assistant Core?
No response
What type of installation are you running?
Home Assistant OS
Integration causing the issue
vicare
Link to integration documentation on our website
https://www.home-assistant.io/integrations/vicare/
Diagnostics information
No response
Example YAML snippet
No response
Anything in the logs that might be useful for us?
No response
Additional information
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 48 (11 by maintainers)
For me it looks a bit like if you get a error 502 “DEVICE_COMMUNICATION_ERROR” a retry is made for every single sensor instead of accepting the missing result for all sensors for this time and retrying at the next scheduled time. That way a failure at one time counts ‘number of sensor’ times for the amount of requests. For me the integration recovers automatically at about 0:00 UTC
@oischinger I’m also worried about the fixed 60 seconds scan interval since 2022.2. Would it not be easier to change the fix scan interval to
120
seconds per default and let user use the manual way to make more frequent updates. That way most user wont get into “troubles”.The reason for
120
seconds as default:The 24h limit is
1450
according to your docs (I was not able to find the numbers ondeveloper.viessmann.com
, only in the forum). If the limit of1450
is really fix, it is really easy to hit the rate limiting.60*24 = 1440
(60 calls per hour), so only 10 calls left. Make the default 120 seconds should lead to30*24=720
(30 calls per hours), which gives 730 calls left per day for “user activity” or automations.@oischinger Thanks for your great work, really appreciate it.
As I wrote I’m not aware of anything else calling the API. I even uninstalled the app from my phone. The documentation still says this:
If this is not supported anymore, can we then update this documentation to contain the steps to do the manual scheduling? I had 120 seconds configured before and it was working fine
Hi eveyone, sorry for not responding earlier. I have to admit that I myself never exceeded the limits except for cases where Viessmann servers seemed to have issues. Nevertheless you are right @tonka3000 . The current update rate leaves little room for any other API use.
Unfortunately the ability to choose the scan_interval yourself was removed by request of the HA Core maintainers. They expect us to disable the automatic update on the integration’s system options and create an automation which triggers the update. This is not very userfriendly of course.
So I think I would follow your suggestion to set it to 120 sec. Unless anyone else has a better idea?
@jzakotnik @AnHardt I just published a fix. Updating to the latest version of the base library should be sufficient.
In my case API rate is always exceeded after my gas heater failure (I have some problems with heater and it get locked from time to time). When my heater stops working API calls are running out pretty fast - didn’t have time to find more info, but wanted to share - maybe there is a way to decrease calls frequency in this scenario.
@tonka3000 I’m still in doubt what is the right limit, especially since Viessmann recently introduced “premium” service models with more API calls.
I would like to document the option to automate a custom polling as a first step: https://github.com/home-assistant/home-assistant.io/pull/22351
Can we maybe add some debug logging to check if more API calls than expected are happening? I have configured it for the vicare component like this but it doesn’t seem to log each call.
I have my polling automation configured to 180 seconds now and at 1am I still have rate-limit errors in the logs occasionally. Looking at the API usage stats it’s only HA showing up, so there is no other API consumer.
Is it possible to change the scan_intervall in the integration page ? I did not found it.