vincentwolsink / home_assistant_micronova_agua_iot

Home Assistant integration controlling heating devices (pellet stoves) connected via the Agua IOT platform of Micronova
Apache License 2.0
34 stars 15 forks source link

Amount of API calls? #130

Closed gzeel closed 9 months ago

gzeel commented 10 months ago

To avoid problems like with the Haier integration, how many API calls does this integration actually make? (It looks like it's 3 per minute) When I look at my DNS statistics I see almost 8400 calls in the past 24 hours to agua-iot.com

There have been no complaints so far, but I can imagine that API providers will take a stricter look. Is it possible to reduce the number of calls?

vincentwolsink commented 10 months ago

Currently I use the default Home Assistant update rate. We can limit this, but of course that means the sensors on the integration will update less often.

I don’t expect any issues for now, since each stove brand has their own API endpoint/server so load will be distributed across those. Also this integration is way less popular than the Haier one.

vincentwolsink commented 10 months ago

Btw, we don’t update 3x per minute, but the way the API is designed we need to do a request for information call and then poll until it is ready. So unfortunately this is multiple calls per update.

jipem01 commented 10 months ago

Hi Vincent,If I remember well, the underlying API originally used (pyaguaiot), was performing two calls at least to update sensors :- one to update registers value,- a second one to update the register map (the 'dictionnary')I think than the register map depend only on the stove model (provably even stove manufacturer).Maybe we could consider it "static" once stove initialisation is done, keep it in memory and never call it again (are at a limited rate).It would be a way to reduce load on servers, but also on HA host.

vincentwolsink commented 10 months ago

Hi @jipem01. Good suggestion, I actually already implemented that a while ago ;)

vincentwolsink commented 9 months ago

Was debugging something and found that I could probably save us a http request per update: #132

vincentwolsink commented 9 months ago

@gzeel Did the amount of calls go down for you since the latest version?

gzeel commented 9 months ago

@vincentwolsink According to the DNS logs from 6 calls to 4 .