Multiple devices vs rate limiting
Closed this issue · 2 comments
Hi @woehrl01
I recently started implementing multiple devices support: oischinger/ha_vicare#120
Works quite well but I noticed a major problem, especially for users of the non-paid API:
Since we have a PyVicareCachedService object for each device the rate limiting doesn't work as before. we now make number of devices * rate_limit requests.
Some users have installed thermostats which are all individual devices. This will lead to a huge amount of requests.
I had a look at the code and to me it seems that it is impossible to use a single request for all devices since every device has a different endpoint.
Do you agree with my analysis?
Another question: should we refactor PyVicare to use a single service and take care of rate-limiting multiple devices or should we rather take care of this in the HA integration? what's your opinion on this?
@oischinger I agree that this is not possible, because every device has its own endpoint which results that for every device we have to consume a call of the API limit.
I suggest the following: that we implement this from the home assistant side where we set the refresh rate to 60*[device count] you integrate. That would be the most cleanest option in my opinion.
OK, sounds good.
On top of that I guess I'll add an option for users of the paid API to allow a higher rate for them.