home_assistant_ebeco
home_assistant_ebeco copied to clipboard
Handle rate limiting of API requests
För att undvika missbruk av API:et begränsas antalet förfrågningar på IP-adressnivå. Du får skicka sammanlagt totalt 10 förfrågningar inom en period på 10 sekunder och totalt 30 förfrågningar inom en period på 60 sekunder. Om antalet förfrågningar överskrids returnerar API:et ”HTTP 429 För många förfrågningar” under återstoden av den aktuella perioden. När perioden är slut börjar API:et att svara igen.
This add-on should do one request per minute per device in regular operation, plus one request each time you change the target temperature or anything like that.
Should add handling of HTTP 429 responses and add retries/backoffs or just wait, depending on the type of request.
Originally posted by @PerfectlyNormal in https://github.com/joggs/home_assistant_ebeco/issues/8#issuecomment-1025539611
how do I change how often the addon should send a request? For me one per minute is too seldom and would like one request every 5 seconds
It’s not configurable without editing the code. It can be found in https://github.com/joggs/home_assistant_ebeco/blob/47d1fb572a102857edcfcbfd200f71e35b24f0f4/custom_components/ebeco/const.py
REFRESH_INTERVAL_MINUTES = 1
but there is a limit to how many requests you can make per minute
Thanks for the reply. I am not a coder so is it sufficient that I just edit the const.py and the addon catch the change? If I want to change this to seconds instead of minutes, how do I do that? Can I use decimals for seconds? 0.5 for 30 secs?
HeyYeah, changing that and reloading the integration (simplest to reboot HA) should be enough. It will be reverted when/if you install a new version of the integration, so keep that in mind. Might be an idea to make the interval configurable in a later version. Should work with decimals yes, but I haven’t tried it myself. Best regards,Per Christian B. VikenSent from my iPhoneOn 20 Oct 2022, at 15:07, dajomu1 @.***> wrote: Thanks for the reply. I am not a coder so is it sufficient that I just edit the const.py and the addon catch the change? If I want to change this to seconds instead of minutes, how do I do that? Can I use decimals for seconds? 0.5 for 30 secs?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>