dasshubham762 / atomberg-integration

Home Assistant integration for Atomberg Fans.
MIT License
26 stars 3 forks source link

API Rate Limited #13

Closed tanishqmanuja closed 5 months ago

tanishqmanuja commented 5 months ago

Atomberg has rate limited the public API, So most of the time my HA Dashboard looks like this (image below) image

Do you know any follow up on this from Atomberg, have you mailed them regarding this ?

PS: I Mailed Atomberg regarding HA Integration and they said they are working on it, and provided me this repo link as a workaround until then. But now this integration is not that useful due to the rate limit. Maybe we could use push based logic in the integration rather than polling to save quota ?

image

dasshubham762 commented 5 months ago

Restarting HA fixes the issue?

tanishqmanuja commented 5 months ago

Nope

tanishqmanuja commented 5 months ago

The limit is 100 calls a day!

By simple math, if the integration uses a polling interval of 15s per device

In my case: Number of devices = 2 Max calls per device = 100/2 = 50 requests Max Active Time per device = 50x15 = 750 seconds = 12.5 minutes

So 12.5 mins per device per day is what we expect with 2 devices, that too ignoring any other api calls if any present in the code.

dasshubham762 commented 5 months ago

It does not work like that. It sends a request initially to get the list of devices and then uses API calls to only send commands. It does not use polling. It receives status updates through UDP locally.

dasshubham762 commented 5 months ago

Btw, do you have HA and Fans on the same network?

tanishqmanuja commented 5 months ago

Ohh mb, If this doesnt use polling via http .. then limit shouldn't be a problem.

Btw, do you have HA and Fans on the same network?

Yes I have them on same network, Maybe then I should debug UDP connection ?

dasshubham762 commented 5 months ago

Where are you running your HA instance? (Eg. Docker or HA OS)

tanishqmanuja commented 5 months ago

Docker Instance with network set to host

---
services:
  home-assistant:
    container_name: home-assistant
    image: homeassistant/home-assistant:stable
    network_mode: host
    privileged: true
    volumes:
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
      - ../store/homeassistant:/config
    environment:
      - TZ=$TZ
    restart: unless-stopped
dasshubham762 commented 5 months ago

sudo ufw allow 5625

Try running this command from terminal if you have ufw enabled

tanishqmanuja commented 5 months ago

Works now as expected .. i recently turned on firewall because I was exposing a ssh connection forgot to allow this UDP port though. Thanks a lot for the quick help 😁

tanishqmanuja commented 5 months ago

Maybe adding the port to the readme could be useful for future references just in case someone does the same as me. Also you can close this issue now

dasshubham762 commented 5 months ago

Sure, I'll update the instructions.

Happy to help you.