LaggAt / hacs-govee

A HACS repository for Govee light integration
MIT License
262 stars 60 forks source link

Rate limited! the limit is 10000 requests every 24 hours. #129

Open vaderag opened 10 months ago

vaderag commented 10 months ago

Version of the custom_component

0.2.2

Configuration

image

Describe the bug

I just updated Home Assistant and a couple of other plugins - I only have two Govee devices, one of which I actually don't use with Home Assistant (I wanted to which is how I ended up noticing this) and the other only gets used Weekdays when it gets dark (so has not been used in 72hrs

There is absolutely no way I could have hit the API limit unless something strange is going on that I have no visibility on

Debug log

Error setting up entry govee for govee 11:15:36 – (ERROR) config_entries.py - message first occurred at 11:08:53 and shows up 3 times 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."} 11:15:36 – (WARNING) Govee (custom integration) - message first occurred at 11:08:53 and shows up 3 times Rate limit exceeded, check if other devices also utilize the govee API 11:15:36 – (WARNING) Govee (custom integration) - message first occurred at 11:08:53 and shows up 3 times API is back online. 11:15:36 – (WARNING) Govee (custom integration) - message first occurred at 11:08:53 and shows up 3 times

home-assistant_govee_2023-10-23T10-30-15.276Z.log

Add your logs here.

sysmd commented 10 months ago

I have the same issue

This error originated from a custom integration.

Logger: custom_components.govee Source: custom_components/govee/init.py:66 Integration: Govee (documentation, issues) First occurred: 11:28:52 AM (1 occurrences) Last logged: 11:28:52 AM

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."}

jonnypurple commented 10 months ago

Also having the same issue.

piratejimm commented 10 months ago

Yes! Recent problem that I am seeing with my Govee devices. Started this week. For me it is.most noticeable in the mornings. Automations don't work with govee products until later in the day. Strangely, I am not getting error messages, just no reaction from govee bulbs and LEDs to commands.

Reloading the govee integration, then restarting homeassistant seems to work, but that's an intrusive process when I am getting ready for the work day.

fortiko commented 10 months ago

Hello! Just installed this, and made the observation that "Rate limit total" is now set to 100 (probably per hour), instead of 10.000 requests per day. Could be a recent change, perhaps that helps?

Also "Rate limit reset seconds" value of -1,698,685,664.87 and "Rate limit reset" on 1 January 1970 at 01:00:00 somehow seem wrong.

joshfedo commented 10 months ago

Im seeing the same issue:

Logger: custom_components.govee Source: custom_components/govee/init.py:66 Integration: Govee (documentation, issues) First occurred: 11:54:24 AM (2 occurrences) Last logged: 11:55:28 AM

Could not connect to Govee API: API: API-Error 429: {"message":"rate limited! the limit is 10000 requests every 24 hours.

Also seeing after a HA reboot:

Logger: homeassistant.config_entries Source: config_entries.py:402 First occurred: 11:54:24 AM (2 occurrences) Last logged: 11:55:28 AM

Error setting up entry govee for govee Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 402, 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' X-RateLimit-Reset in Http Response Header shows the reset time."}

szympulka commented 10 months ago

This is not a problem with Integration vs goove. They have limits set to not overload the servers. I don't know why, but they use http protocol which is pointless in smart home devices. Limits are set by goove and already here I can say that it is not worth buying their solutions

vaderag commented 10 months ago

This is not a problem with Integration vs goove. They have limits set to not overload the servers. I don't know why, but they use http protocol which is pointless in smart home devices. Limits are set by goove and already here I can say that it is not worth buying their solutions

The limit is Govee, but the issue here is that the integration is causing this when people only have one (or two) devices and a rate limit set in the integration

szympulka commented 10 months ago

I already understand. The problem is that the integration has no lag. Therefore, any change, even the smallest one, is sending a dozen requests to the server

vaderag commented 10 months ago

I already understand. The problem is that the integration has no lag. Therefore, any change, even the smallest one, is sending a dozen requests to the server

No, you're describing a normal operation My light was not being used. The only thing I had done was update home assistant There is a restriction in the integration, this is set correctly so if the integration is working then there should be no way the API limit could be reached. The light I have (and from reading the comments others too) was not used at all when the limit was hit

Therefore the integration was causing API calls outside of intended operation - a bug

rryke commented 10 months ago

Are there any workarounds for this?

charmarkk commented 9 months ago

+1 - just got this set up, tried one or two bulbs to make sure it was working, rebooted, then cut off.

angrycatmeowmeow commented 9 months ago

Hate to be that guy chiming in with no solution, but I'm only here to say "same". Only have two govee devices due to the poor HA integration and I'm getting the rate limit error. An H605C TV back light that turns on when the TV turns on (and visa versa), so that only gets used twice a day, and yesterday I added a rope light that turns on with sunrise and off when we go to bed. So both combined are only getting four commands a day. Unfortunately only the rope light is capable of LAN control.

danilomichelucci commented 9 months ago

Having the same issues here... Maybe a tunning with the integration to make less requests ?

angrycatmeowmeow commented 9 months ago

Go to your govee integration in HA, go to configure, and change the polling interval from 10 to something higher. I changed mine to 60 seconds. You're limited to 10,000/day, so do some math based on how many devices you have and figure out how often you can safely poll. The default is 10 seconds which is way too frequent IMO and one device will come close to the 10k limit in 24h.

tdlamey commented 9 months ago

I also have this issue, however I may have stumbled onto something that helps. It's by no means a fix, but perhaps at least a temporary stop-gap measure, and maybe this information will help developers hunt down the actual fix.

Ever since adding the Govee integration, I would have the rate limit error fairly consistently, even when not using my device at all. I've got 17 Govee devices, so it's not too surprising. I even set my polling interval to 61 seconds, so that there would only be 1 poll per device per minute (well within the provided allotment) with an extra second of buffer for good measure.

About a week or two ago, I found (I'm still fairly new to HA) some additional settings that seem to have helped. Since changing these settings, I haven't hit the rate limit once, even when actually using my devices. HUZZAH!!

Here's what I did... Go to the Integrations page, then open the Govee integration. Click the three dots icon for your integration entry and select "System options". image

Both the below settings were ON (by default) and I turned them both OFF. image

I assume it was the "Enable polling for updates" that did the trick, but I can see how "Enable newly added entities" might also blow through the polling allotment pretty quickly, if the Govee API is used to discover new devices.

Like I said, I'm still pretty new to HA, so sorry for wasting your time if this isn't a help, but hopefully it is. I haven't hit the rate limit once since making this change, and I can't imagine what else would've been the cause.

EDIT: In case this helps, I am currently using version 0.2.2

tjdavisbz commented 9 months ago

For whatever it is worth - I have 5 devices and, not knowing about the rate limiting, I left polling at 10 seconds. Needless to say, my devices would work in HA during the day then stop working at night. I eventually realized what was going on and changed the polling to 60 seconds but the Govee integration wouldn't load on HA restart. I waited several hours and tried again and it still wouldn't load. I applied for a new API token, put it in and it loaded.

Soooo...I would think that would mean that Govee is rate limiting by API key (as opposed to IP) and so the developer could probably give the option to provide multiple API keys and then do a round robin on keys to keep from being rate limited. Might end up making Govee hate us if we go that route and then IP rate limit but just an idea.

davehamer commented 9 months ago

I also have this issue, however I may have stumbled onto something that helps. It's by no means a fix, but perhaps at least a temporary stop-gap measure, and maybe this information will help developers hunt down the actual fix.

Ever since adding the Govee integration, I would have the rate limit error fairly consistently, even when not using my device at all. I've got 17 Govee devices, so it's not too surprising. I even set my polling interval to 61 seconds, so that there would only be 1 poll per device per minute (well within the provided allotment) with an extra second of buffer for good measure.

About a week or two ago, I found (I'm still fairly new to HA) some additional settings that seem to have helped. Since changing these settings, I haven't hit the rate limit once, even when actually using my devices. HUZZAH!!

Here's what I did... Go to the Integrations page, then open the Govee integration. Click the three dots icon for your integration entry and select "System options". image

Both the below settings were ON (by default) and I turned them both OFF. image

I assume it was the "Enable polling for updates" that did the trick, but I can see how "Enable newly added entities" might also blow through the polling allotment pretty quickly, if the Govee API is used to discover new devices.

Like I said, I'm still pretty new to HA, so sorry for wasting your time if this isn't a help, but hopefully it is. I haven't hit the rate limit once since making this change, and I can't imagine what else would've been the cause.

EDIT: In case this helps, I am currently using version 0.2.2

My question is: if you make this change, what does it do? :)

Just to add I have 5 light strips, and MANY errors! First occurred: 12 December 2023 at 02:06:50 (98603 occurrences)