Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Limit Keeps getting hit #190

Open
Dawe5ome opened this issue Nov 21, 2024 · 11 comments
Open

API Limit Keeps getting hit #190

Dawe5ome opened this issue Nov 21, 2024 · 11 comments

Comments

@Dawe5ome
Copy link

Version of the custom_component

2023.11.1

Configuration

I am running HA on a Raspberry Pi 5 using docker (as I have other integrations working on my pi).

I have 10 lights that I am controlling, they are:

  • 8xH6008 (Govee Smart Light Bulbs, Color Changing Light Bulb, Work with Alexa and Google Assistant, 16 Million Colors RGBWW, WiFi & Bluetooth LED Light Bulbs, Music Sync, A19, 800 Lumens)
  • 1xH605C (Govee Envisual TV LED Backlight T2)
  • 1xH7021 (Govee Smart Outdoor String Lights H7021, RGBIC Warm White 96ft (2 Ropes of 48ft) LED Bulbs, WiFi Patio Lights Work with Alexa, Google, APP Control, IP65 Waterproof)

My set up of the lights looks like this:

  • Bedroom: 2xH6008s (both in a helper light group called Bedroom)
  • Kitchen: 3xH6008s (all in a helper light group called Kitchen)
  • Living Room: 2xH6008s (both in a helper light group called Living Room), 1xH605C (not in helper light group)
  • Entry Way: 1xH6008
  • Patio: 1xH7021

Here are the settings I have with it:
image
image

Describe the bug

The API limit of 10000 requests every 24 hours keeps being initialized. However this only happens when I assign my lights to an automation. If I leave my lights just as their own then I typically don't have issues besides the odd disconnect. I decided today would be a good day to test out an automation for turning on my lights if my home state changes from 0 to 1 person coming home. Then I hit the API limit.

What is the point of having Govee on HA if every time I try to do anything somewhat smart with HA it just hits the limit and I can no longer use it. It has less functionality currently than my Google Home and that thing is absolutely brutal.

Debug log

2024-11-21 16:30:07.707 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-21 16:30:07.707 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration govee which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-11-21 16:30:09.702 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to load_verify_locations with args (<ssl.SSLContext object at 0x7ffe9abfb6d0>, '/usr/local/lib/python3.12/site-packages/certifi/cacert.pem', None, None) inside the event loop by custom integration 'govee' at custom_components/govee/__init__.py, line 53: hub = await Govee.create( (offender: /usr/local/lib/python3.12/ssl.py, line 708: context.load_verify_locations(cafile, capath, cadata)), please create a bug report at https://github.com/LaggAt/hacs-govee/issues
For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_verify_locations
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module>
    sys.exit(main())
  File "/usr/src/homeassistant/homeassistant/__main__.py", line 209, in main
    exit_code = runner.run(runtime_conf)
  File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run
    return loop.run_until_complete(setup_and_run_hass(runtime_config))
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete
    self.run_forever()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever
    self._run_once()
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once
    handle._run()
  File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component
    result = await _async_setup_component(hass, domain, config)
  File "/usr/src/homeassistant/homeassistant/setup.py", line 461, in _async_setup_component
    await asyncio.gather(
  File "/usr/src/homeassistant/homeassistant/setup.py", line 463, in <genexpr>
    create_eager_task(
  File "/usr/src/homeassistant/homeassistant/util/async_.py", line 45, in create_eager_task
    return Task(coro, loop=loop, name=name, eager_start=True)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 783, in async_setup_locked
    await self.async_setup(hass, integration=integration)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 546, in async_setup
    await self.__async_setup_with_context(hass, integration)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/govee/__init__.py", line 53, in async_setup_entry
    hub = await Govee.create(

2024-11-21 16:30:10.029 WARNING (MainThread) [custom_components.govee] API is back online.
2024-11-21 16:30:10.030 WARNING (MainThread) [govee_api_laggat.api] Rate limit exceeded, check if other devices also utilize the govee API
2024-11-21 16:30:10.030 WARNING (MainThread) [custom_components.govee] 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."}
2024-11-21 16:30:10.030 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry govee for govee
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 635, in __async_setup_with_context
    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'. Did you mean: 'rate_limit_reset'?
2024-11-21 16:30:13.281 ERROR (Thread-6) [pychromecast.socket_client] [Bedroom TV(192.168.2.14):8009] Failed to connect to service MDNSServiceInfo(name='Chromecast-51579980351f5acc98270a4eb03d1e61._googlecast._tcp.local.'), retrying in 5.0s

@Dawe5ome Dawe5ome changed the title API Limit Keeps being hit even when there is 1 simple automation API Limit Keeps getting hit Nov 21, 2024
@shunopoli
Copy link

I am having this same issue. Any resolution?

@jlexster2024
Copy link

I just started using HA and added this to it and got the same thing. How do I know what constitutes an API call? I have all govee light bulbs at this point and want to use them in automation.

@t0is
Copy link

t0is commented Nov 25, 2024

Having the same issue as well, adding it to the automation broke it, got the same error

@YewTreeWeb
Copy link

I'm also having the same issue

@Dawe5ome
Copy link
Author

Dawe5ome commented Nov 28, 2024

For those wondering this is still an issue. Even with no automations I still will get the API limit hit.

Something that has helped reduce it a ton with automations is using Google Assistant SDK 'Send text command'. It's completely a roundabout way to do it and you won't know the states and values of your lights but it can at least allow you to turn them on and off, set them to a brightness or colour or even a scene

@Dawe5ome Dawe5ome reopened this Nov 28, 2024
@jlexster2024
Copy link

I ended up trying https://github.com/Beshelmek/govee_ble_lights and haven't had a single rate limit yet. Been about a week now. I don't have any more govee entities set to trigger automations, but I was getting rate limited even with no automations before I switched.

@Sebastian-Voigt
Copy link

Same issue here

@Dawe5ome
Copy link
Author

I ended up trying https://github.com/Beshelmek/govee_ble_lights and haven't had a single rate limit yet. Been about a week now. I don't have any more govee entities set to trigger automations, but I was getting rate limited even with no automations before I switched.

How did you end up installing this? There isn't an installation guide on it

@jlexster2024
Copy link

I ended up trying https://github.com/Beshelmek/govee_ble_lights and haven't had a single rate limit yet. Been about a week now. I don't have any more govee entities set to trigger automations, but I was getting rate limited even with no automations before I switched.

How did you end up installing this? There isn't an installation guide on it

Okay, so you have to have HACS. You go into that, click the three dots in the top right and select "Custom repositories" and put in the URL for the github. It'll be available as an integration then.

@Dawe5ome
Copy link
Author

I ended up trying https://github.com/Beshelmek/govee_ble_lights and haven't had a single rate limit yet. Been about a week now. I don't have any more govee entities set to trigger automations, but I was getting rate limited even with no automations before I switched.

How did you end up installing this? There isn't an installation guide on it

Okay, so you have to have HACS. You go into that, click the three dots in the top right and select "Custom repositories" and put in the URL for the github. It'll be available as an integration then.

Do I need to have this?

For Direct BLE Control:
Before you begin, make certain HomeAssistant can access BLE on your platform. Ensure your HomeAssistant instance is granted permissions to utilize the Bluetooth Low Energy of your host machine.

Or will I be fine without it. I am running HA on a Pi5 in Docker

@jlexster2024
Copy link

It should give you an option to use API or BLE when you configure it. Use API like you did with the hacs-govee one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants