Closed fsaris closed 9 months ago
@rdgout are you sure you're seeing multiple calls to the summary endpoint? The code should already prevent it from being called more then once (if there is a response) https://github.com/fsaris/home-assistant-zonneplan-one/blob/97e14184ec2e3a77c0da943bc5be3b22badba013/custom_components/zonneplan_one/coordinator.py#L129
Ah, found it.
It's called multiple times for the users that are still on the 10seconds interval. Because of the etag check that was added the request can give no response and it will try the other connection.
Now interval is back to 5min it shouldn't happen anymore. But will also update the code that it doesn't depend on a response the prevent a second request
@fsaris great to hear you found it!
We were seeing about 40% more traffic coming our way so it might have been your beta testers (and some others who were on that release). It is pretty important that the 10 seconds limit doesn't work like that for all requests but only for the charge point requests.
I think the next best thing to do for this integration is add some sort of caching layer which allows the amount of requests to be lowered down. For example, the user-accounts/me
endpoint provides information about which contracts you can inquire about. However, it's probably not needed to request this every 5 minutes. Once every hour should probably be more than enough, provided you store the contracts locally and only refresh every hour or when the local store is empty.
From #49
@rdgout the refresh was only for a short time set to 10 seconds and this wasn't part of a official release. Maybe it's the charge point users that are testing a beta, but there is already a new release that only polls every 5 minutes.
Will have a look at the summary call