hacs-govee icon indicating copy to clipboard operation
hacs-govee copied to clipboard

rate limited! the limit is 10000 requests every 24 hours

Open Stormster opened this issue 1 year ago • 27 comments

On the current version of hacs-govee.

Describe the bug

Govee devices go unavailable, log states Warning: Could not connect to Govee API: API: API-Error 429: {"message":"rate limited! the limit is 10000 requests every 24 hours. X-RateLimit-Reset in Http Response Header shows the reset time."}

Soon after, you get Error Error setting up entry govee for govee Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 383, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/govee/init.py", line 67, in async_setup_entry await hub.rate_limit_delay() AttributeError: 'Govee' object has no attribute 'rate_limit_delay'

How can we avoid hitting the limit? Any way to increase the limit? Has the local API been released yet?|

Edit: Local API has been released but only works for select devices. Of course, only half of my devices support it.

Stormster avatar Mar 02 '23 17:03 Stormster

Same just happened to me even though I almost don’t use the lights controlling via the integration

bgoncal avatar Mar 03 '23 16:03 bgoncal

Same here! For testing I have also requested a new API code. Now I get the error message: No connection possible. Is the API key correct and the internet connection ok?

Also, I have completely removed Govee once and added it again. The message comes now also with the first created API, with which it always worked before.

Since I am not the only one, I think that the problem is not with me.

Cranknight avatar Mar 05 '23 16:03 Cranknight

The same thing has happened to me too , so annoying.

Kembletowers avatar Mar 06 '23 13:03 Kembletowers

Happens to me too. I can't see where there are 10000 API calls a day. This could be a new regulation from govee?

WolfRevo avatar Mar 08 '23 09:03 WolfRevo

I can't control my Goovee Light either ... Same Error Rate limit exceed .... Has anybody a workaround ? or a solution ?

JoachimBraun avatar Mar 11 '23 09:03 JoachimBraun

I haven't tried much yet. Planning to set my Govee lights back up through Alexa and HA, rather than through HA then to Alexa. That way at least my voice commands won't count towards the polling limit. I'm sure there's a way to get them strictly working through Alexa and letting HA control them through there, which would solve the polling issue because it calls from a non-limited API. Ridiculous we even have to do all this when they promised a local API long ago.

Stormster avatar Mar 11 '23 16:03 Stormster

Also got this message. Not sure how it was exceeded.

Paulholloway avatar Mar 12 '23 12:03 Paulholloway

Same here.

mauricego avatar Mar 16 '23 16:03 mauricego

same problem

FaLLeNaNg3L82 avatar Mar 24 '23 09:03 FaLLeNaNg3L82

This just happened to me this morning after installing second set of LED strips this weekend. I've been using it a bit this weekend more than usual for testing but nothing extreme.

grex023 avatar Mar 27 '23 05:03 grex023

I was able to fix this by changing the Poll interval to 40 as per here as I didn't realise there was a need to delay having two devices

grex023 avatar Mar 27 '23 10:03 grex023

I've got same issue poll set to 600

Tassel8062 avatar Apr 03 '23 19:04 Tassel8062

Where exactly in that thread? I've tried 10, 20, 40, 80, 200, etc. Almost always hit the limit with just simple on and off a few times a day.

Stormster avatar Apr 12 '23 15:04 Stormster

If anyone wants to help.. Looking into triggering my govee devices via Alexa routine through Home Assistant to avoid the API limit. Might be a decent work around until now, especially just for basic on/off.

Stormster avatar Apr 12 '23 15:04 Stormster

After doing the math (86400 sec in a day / 10000 requests) = 11.57 sec per request So setting your Polling Interval at 12 instead of the default of 10 should fix the issue.

LazyQuad avatar Apr 27 '23 19:04 LazyQuad

I've run into this after adding a second light to my account. It happened two days in a row. Yesterday I set up a counter to increment the number of these I call something that changes the state of these lights and it's only a combined couple dozen yesterday, so it's not raw state changes that are causing the issue.

Given that I had the poll interval set to the default value of 10 and double the number of devices, this had also doubled the state calls and that's what's causing the issue?

I'm really not too concerned with current state being updated, due to changes outside of HA (i.e. changes in the Govee app). They're more or less just toggled on/off with automations. I can use helpers to keep track of the state in HA.

Edit: changing it to 60 didn't help. Still got rate limited today after it being enable for far less than 24 hrs.

Maybe it's time to set it up via Rest API calls like I have with my Govee fan.

AndySomnifac avatar Apr 30 '23 16:04 AndySomnifac

same here.

NeverUsedID avatar May 02 '23 08:05 NeverUsedID

For me change poll interval to 60 solved problem. I have 2 govee devices. If someone has more devices, this value i think should be increased to a larger value depending on how many devices You have

Adnotacja 2023-05-06 101155

KitHubek avatar May 06 '23 08:05 KitHubek

I’m having the same issue. I have 2 devices with the poll limit set to 600 & it’s still not working.

zayspringer avatar May 20 '23 20:05 zayspringer

Same, only installed yesterday, and already doesn't work :( I'm going to wait 24H and try tommorow again, maybe it will start working

SergioSerrao avatar May 21 '23 18:05 SergioSerrao

I was hoping it would reset for me after midnight but I’m well into my 2nd day of this issue & it still hasn’t been resolved.

Sent from my iPhone

On May 21, 2023, at 2:33 PM, SergioSerrao @.***> wrote:



Same, only installed yesterday, and already doesn't work :( I'm going to wait 24H and try tommorow again, maybe it will start working

— Reply to this email directly, view it on GitHubhttps://github.com/LaggAt/hacs-govee/issues/107#issuecomment-1556252643, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A2LZY7JCOIROPS4DEBQGYMLXHJNXZANCNFSM6AAAAAAVNUUQ4A. You are receiving this because you commented.Message ID: @.***>

zayspringer avatar May 21 '23 19:05 zayspringer

Same here.

After adding a second device I can't control none of them.

Tried different intervals but didn't help:

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.govee.config_flow
Source: custom_components/govee/config_flow.py:34 
Integration: Govee (documentation, issues) 
First occurred: 18:12:10 (5 occurrences) 
Last logged: 18:25:38

Cannot connect: API: API-Error 429: {"message":"rate limited! the limit is 10000 requests every 24 hours. X-RateLimit-Reset in Http Response Header shows the reset time."}
Traceback (most recent call last):
  File "/config/custom_components/govee/config_flow.py", line 68, in async_step_user
    user_input = await validate_api_key(self.hass, user_input)
  File "/config/custom_components/govee/config_flow.py", line 34, in validate_api_key
    raise CannotConnect(error)
custom_components.govee.config_flow.CannotConnect: API: API-Error 429: {"message":"rate limited! the limit is 10000 requests every 24 hours. X-RateLimit-Reset in Http Response Header shows the reset time."}

superpower10 avatar May 27 '23 16:05 superpower10

I was able to fix mine. I requested a 2nd API Key from Govee, then setup a 2nd Govee integration using the new API Key. I set the poll interval to 600 & I haven’t had any issues since. The devices automatically populated with the same names, etc & all of the previous automations were still active with the new integration. After everything was confirmed to be working I deleted the original integration. I hope this works for you!

zayspringer avatar May 27 '23 18:05 zayspringer

@zayspringer: Deleted my Integration. Restart. Added it again. Restart.

Tried to add Govee again with new API-Key.

No difference. Doesn't work.

Tried Govee-API with an API-Tester and with old and new API-Key. Both get the response that I posted. If I read the numbers in the Response-Header correctly, I need to wait 24 hours. Which I will do tomorrow

superpower10 avatar May 27 '23 18:05 superpower10

After waiting 24 hours. It worked.

Hopefully it will stay that way when I start adding new devices

superpower10 avatar May 29 '23 10:05 superpower10

So this problem is still persisting. I have 4 devices and NEVER use HA to turn on these lights other than 2 automations. One at sunset to turn them on and the other at midnight to turn them off (They are outdoor lights). I have tried a new API key, interval pull to 600. Get the same error as above. Attempted to delete and readd the integration and now it just says that the API key is wrong/no internet connection which isn't true. Any help would be appreciated.

m1cypher avatar Aug 22 '23 18:08 m1cypher

hey @Stormster I've had this integration going on for a long time and have been a victim of this issue a lot, especially the more I added govee products to my integration. I went to ChatGPT and fed it all the information I could from what I know of:

  1. The integration
  2. The Govee API
  3. User comments in forums and this is what it told me. (in my case, for 4 products), but the critical piece here is the logic and math on how to find the correct pull interval:

Logical Analysis:

  1. Daily API Limit: 10,000 calls per 24 hours. Since you have 4 devices, this effectively becomes 10,000 / 4 = 2,500 calls per device per 24 hours.
  2. Per-Minute API Limit: 60 calls per minute according to Home Assistant and 10 per minute per device from Govee's API documentation. The more stringent limit is 10, which is applicable per device.
  3. User Activity: Besides the automated polling, consider the manual interactions you might have like adjusting brightness or turning devices on/off. Assume an average of 50 such manual actions per device per day as a placeholder.

Configuration:

  1. Reserve for Manual: 50 manual actions x 4 devices = 200 calls per day are reserved for manual actions.
  2. Daily Available for Polling: 10,000 total - 200 reserved = 9,800 for automated pulls. Per device, this would be 9,800 / 4 = 2,450 pulls.
  3. Pull Interval: There are 86,400 seconds in a day. 86,400 / 2,450 pulls = 35.28 seconds per pull per device to stay under the daily limit.
  4. Per-Minute Safeguard: 60 seconds / 10 = 6 seconds is the quickest you could safely pull without hitting the per-minute limit. Since our calculated value is higher, it is safe.

Recommendations:

  1. Optimal Pull Interval: Based on daily and per-minute limits, setting the pull interval to around 35-40 seconds should keep you safe from hitting the API rate limits while still providing fairly real-time updates.

AlxSZP avatar Sep 24 '23 13:09 AlxSZP