LaggAt / hacs-govee

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

Govee #72

Open rhoskins61 opened 2 years ago

rhoskins61 commented 2 years ago

Integration for HA just stopped working. Applied for new API, still causing errors. What's the problem?

JohnMachete commented 2 years ago

Same issue, couldn't control devices, restarted HA and the Govee integration was throwing an error, something like the Govee object had no property of poll_rate or polling_rate or something like that, can't find it now since I removed and reinstalled the latest Govee integration.

Can't add the integration though since I can't put in my API key. Getting Cannot connect. Is the API-Key correct and the internet connection working? error. Applied for new key and same thing. Assume either the developer API is down/broken?

marcoecheverria commented 2 years ago

Correct. I am having the same problem: Is the API-Key correct and the internet connection working?. I have tried downloading from HACS and updating the repo. Also, I tried generating different API from the Govee app. Please, help.

nitro41992 commented 2 years ago

Im having the same issue and tried re-downloading and applying another API key. Not sure how to proceed.

rhoskins61 commented 2 years ago

I sent a quick Govee Support Request.. we'll see what they say. Seems to me to be a Govee issue rather than this integration, but who knows.

nitro41992 commented 2 years ago

image Seems like an issue with the API itself, cant even get it to work

image The documentation says 10,000 per day allowed. The API message says that the max "10000 in 86400000 seconds" which is like 2+ years. Im not sure what that means but I hope we dont have to wait that long for it to be back.

This is definitely a problem with the Govee API. Not sure if we will see a fix soon.

trixor commented 2 years ago

Thing stopped working here as well, seems they have an error in their API. Same error as: Govee API: API: API-Error 429: {"message":"rate limited,the limit is max 10000 in 86400000 seconds. see X-RateLimit-Reset in Response Header"}

The documentation talks about not exceeding 1000 calls per user per day, followed by a maximum a table that shows 10K requests per user per day maximum.

It seems when they reconfigured the API, they added a few extra zero's to their intended configuration (3 to be exact), as 24h is 86400 seconds instead of what seems to be configured 86400000 seconds.

In the meanwhile, I'm applying for a new key, as well as significantly increasing my polling to hopefully keep using my lights while they sort this out :)

schumi2309 commented 2 years ago

a new api doesn't work either. I hope the problem will be fixed.

zkarampa commented 2 years ago

the limit is max 10000 in 86400000 seconds.

I guess they meant ms rather than seconds :facepalm:

marcoecheverria commented 2 years ago

I sent a note to api-support@govee.com explaining the situation. I'll keep you posted if I hear from them. Feel free to send more emails. I am pretty sure you can explain the problem way better.

Scope666 commented 2 years ago

Same error:

2022-05-05 17:51:18 WARNING (MainThread) [govee_api_laggat.govee_api_laggat] error getting state for device GoveeDevice(device='E0:EF:A4:C1:38:5F:xx:xx', model='H6159', device_name='Theater LED', controllable=True, retrievable=True, support_cmds=['turn', 'brightness', 'color', 'colorTem'], support_turn=True, support_brightness=True, support_color=True, support_color_tem=True, online=True, power_state=False, brightness=254, color=(0, 0, 255), color_temp=0, timestamp=1651766818.240145, source=<GoveeSource.API: 'api'>, error='API-Error 429: {"message":"rate limited,the limit is max 10000 in 86400000 seconds. see X-RateLimit-Reset in Response Header"}', lock_set_until=0, lock_get_until=0, learned_set_brightness_max=100, learned_get_brightness_max=100, before_set_brightness_turn_on=False, config_offline_is_off=False): API-Error 429: {"message":"rate limited,the limit is max 10000 in 86400000 seconds. see X-RateLimit-Reset in Response Header"}

omayhemo commented 2 years ago

Seems like the api has changed, but the integration has not.

Scope666 commented 2 years ago

@trixor explained the problem perfectly above, they added 3 extra zeros to their rate limiting. You can see it in my log output above.

marcoecheverria commented 2 years ago

Here is the response I received from Govee: Hello , Thank you for contacting Govee here. Due to the limited resources of the API server, the flow of some high-frequency API calls will be limited in order to make the API server more stable and serve more users. The limit on API call frequency was implemented started May 5, 2022. If your current usage scenario calls the API frequently, your application might be affected and may not function properly. Therefore, you will need to modify your applications to call the API less frequently. Specific rules related to this are listed in the latest API reference document here: https://govee-public.s3.amazonaws.com/developer-docs/GoveeDeveloperAPIReference.pdf

Thank you for your understanding.

Sharon Govee Customer Support

trixor commented 2 years ago

Dear customer,

Thank you for contacting Govee.

Here is the picture attached. X-RateLimit-Limit,X-RateLimit-Remaining,X-RateLimit-Reset (this level of limit works on all APls, which means total requests from oneuser can not be more than 1000 per day).

Your kind understanding is much appreciated.

Best wishes,

Jane

I'm going to respond once more, I assume this is their canned response they give to everyone right now who messages them as they anticipated this to break a lot of people, though right now I think they broke people more than they intended too.

a-bianucci commented 2 years ago

So given the error message, and implying years, do we just have to wait 24 hours, what are we thinking here?

trixor commented 2 years ago

I've reduced my polling to 600 (from 10), and I'm hoping we'll see a reset in a few hours. I'm not sure when the 24h limit started, did anyone capture this by chance? Reading the documentation, we can actually ask the API how much longer we're in timeout, I may give that a go and post my results.

nitro41992 commented 2 years ago

@a-bianucci Seems like I have to wait 3 hours. Probably the same for most here.

What I don't understand is that I doubt I'm anywhere near 10000 calls a day, and even more confusing, I've been limited all day. Not sure why I was limited so early in the morning. Unless there are some calls being made under the hood by the integration every few seconds. (10,000 a day is like ~7 calls a minute)

image

a-bianucci commented 2 years ago

@nitro41992 Thanks! Unfortunately since I just tried, assuming I will have to try again in the morning.

It is strange, I don't think I'm at that volume either. I have 2 lights that are on Govee, and I was configured with "10" as the default. The lights are auto on\off based on TOD, so essentially 4 calls a day, plus whatever polling the integration does. I can't imagine that I have hit the limit with my use.

I know Govee just did some API change on the 4th, so I'm wondering if there is more to this.

a-bianucci commented 2 years ago

I've reduced my polling to 600 (from 10), and I'm hoping we'll see a reset in a few hours. I'm not sure when the 24h limit started, did anyone capture this by chance? Reading the documentation, we can actually ask the API how much longer we're in timeout, I may give that a go and post my results.

Yeah I can't do that yet.... before I came here I tried to remove, and readd so I can't even get it back in HASS at the moment. But leveraging Nitro's screenshots, I can see my time is about 2h 45m from now so.... the am it will be :(

Bison010 commented 2 years ago

I’m having the same issues or rate limit exceeded and I only have 2 govee Light strips triggered by a motion sensor. This just started on the 5th of May. Any help would be appreciated

Bison010 commented 2 years ago

Mine is back up after updating HASOS to 2022.5.1. Hopefully it stays working

pgelinas98 commented 2 years ago

So I deleted the integration along with the HACS integration along with requesting a new API from Govee. So I downloaded the HACS integration this morning and tried adding my new api and it seems to be back up in running. I also updated HA to 2022.5.1 as well.

rhoskins61 commented 2 years ago

Yeah, the integration finally took the new API (that I received yesterday), rebooted HA and all is back.... strange.

Clarky3 commented 2 years ago

I just disabled the govee integration and then re-enabled it. All working fine now

TomCasavant commented 2 years ago

I didn't have to do anything, mine just started back up sometime last night

a-bianucci commented 2 years ago

I adjust my poll interval up to 60 and it's used 70 requests in the last 30 minutes for 2 lights.

To slow the polling doesn't that number have to go up? Or do I have it backwards?

Morteum9 commented 2 years ago

Same here issues here, I have tried disabling the integration and re-enabling.

Have updated to 2022.5.1 as well this morning, that did not correct it either.

It was odd that a couple of my lights worked on schedules for wake up routines but not others by the time we got downstairs to start our day.

Now they are all offline according to Home Assistant.

omayhemo commented 2 years ago

Disabled and Re-Enabled the integration this morning and received an initial warning in the logs which said the API is back online. Is now working fine.

JohnMachete commented 2 years ago

Tried reinstalling the integration yesterday and re-inputting my API key but was getting the API error from the integration and couldn't finish adding the integration. Requested a new API key and had the same issue. Tried inputting the new API key all day yesterday to no success.

The new API key now works this morning. Upped the poll interval to 60, and for 5 devices in 30 minutes I've used about 160 API requests based on the X-RateLimit-Remaining I'm getting back for my API key. That equals out to about 1 request per devices, per minute, plus me turning them on and off a few times.

Morteum9 commented 2 years ago

Disabled and Re-Enabled the integration this morning and received an initial warning in the logs which said the API is back online. Is now working fine.

Tried again just now and not getting the lights to work still... Not vital as the sun is still rising here and the room is light enough from that but certainly going to hear about it if these lights still don't work tonight

TomCasavant commented 2 years ago

Yeah, mine were working again this morning but they're down again

pgelinas98 commented 2 years ago

Mine seems to be running fine still

a-bianucci commented 2 years ago

Tried reinstalling the integration yesterday and re-inputting my API key but was getting the API error from the integration and couldn't finish adding the integration. Requested a new API key and had the same issue. Tried inputting the new API key all day yesterday to no success.

The new API key now works this morning. Upped the poll interval to 60, and for 5 devices in 30 minutes I've used about 160 API requests based on the X-RateLimit-Remaining I'm getting back for my API key. That equals out to about 1 request per devices, per minute, plus me turning them on and off a few times.

Did the math on mine since I re-enabled it, seeing about 2.4 requests per minute per device.

One thing I did do is run a check on the API to see the reset time, it gave me 24h from the time I ran it vice the first poll earlier. I wonder if it's a rolling clock of some sort.

trixor commented 2 years ago

From Govee support:

Dear customer,

I'm sincerely sorry for the mess of the wrong number.

It allows 10k per day and it's 86400 seconds. Thanks for your careful discover. I have conveyed to the relevant department.

Thank you again.

Seems the department is aware that they have a bug and are working on allowing 10K requests per day (86400 seconds). My old API key really no longer worked, so I requested a new one. My lights are happy again! Still need to do the math on polling for the number of lights I have in this place.

Morteum9 commented 2 years ago

I just asked for a new API key and cannot get it to take, it claims "Cannot connect. Is the API-Key correct and the internet connection working?" now...

Juffle74 commented 2 years ago

Mine are back today and working fine but something seems wrong with all of them showing negative remaining limit and the timestamp... Screenshot_20220506-135856_Home Assistant

pgelinas98 commented 2 years ago

Seems to be having an issue again

blondebeardtech commented 2 years ago

Does anyone have a suggestion for calculating what the poll interval should be considering the new rate limitations? (1000 requests per user per day maximum before triggering a 24 hour timeout)

rhoskins61 commented 2 years ago

Not working again...

trixor commented 2 years ago

I increased to 600 polling, 10-ish lights, no issues so far

blondebeardtech commented 2 years ago

I increased to 600 polling, 10-ish lights, no issues so far

I have about the same qty so I'll give that a shot. T-16 hours till Govee lets my account out of the doghouse to try again.

pgelinas98 commented 2 years ago

Probably a silly question but how do you adjust the polling?

blondebeardtech commented 2 years ago

Probably a silly question but how do you adjust the polling?

In HA 2022.05.0, go to Devices & Services -> Integrations -> Govee -> Configure -> Polling should be below your API key field.

pgelinas98 commented 2 years ago

Probably a silly question but how do you adjust the polling?

In HA 2022.05.0, go to Devices & Services -> Integrations -> Govee -> Configure -> Polling should be below your API key field.

Ok thank you. Now I should change the 10 to the 600?

DERFAUSt commented 2 years ago

Probably a silly question but how do you adjust the polling?

In HA 2022.05.0, go to Devices & Services -> Integrations -> Govee -> Configure -> Polling should be below your API key field.

Ok thank you. Now I should change the 10 to the 600?

lol....i have the same question...so just change the Poll Interval from 10 to 600? i just want to be sure so when the timer starts over, it si set right.... ..... and if someone could explain why going from 10 to 600 was the thing that would awesome too :).... ty!

Juffle74 commented 2 years ago

I might be wrong but I believe the poll interval set the delay between each time the integration check the states of all your govee lights on the govee api server.

So lets say you have 10 govee lights and the poll interval is set at 10 secs.

  1. This will result in 86400 hits per day on the 10000 per day rate limit. You will then reach that limit in about 3 hours and wont be able to control any light for the next 21 hours.

  2. This will also result in 6 hits on the 10 per minute per device rate limit for each lights.

Setting the poll interval at 600 secs for the same 10 lights will result in 1440 hits on the same limit so you will have 8560 left for turning light on/off, changing color, etc... But doing so will result in HA refreshing state of the govee lights every 10 minutes.

It's all about how many lights you have and a balance between state refreshing and control/change you can do per day.

For my part, I have 7 lights and I set the poll interval to every 120 secs. That way, I have around 5000 left in the rate limit per day.

Also, one need to make sure that automation don't turn on lights that are already on every time a motion sensor is activated or it will take many hits on the limits.

Anyway that is how I understand how it is working but I might be wrong.

Also, Govee said a while ago that they are working in changing the state request so that it return all lights state at once. This would help.

rhoskins61 commented 2 years ago

Dumb question for me... how do you start this "timer" over? I changed the interval to 600 and submitted with the current API, which indicates success, however all of my devices are still disabled after reboot.

LukeBH commented 2 years ago

Dumb question for me... how do you start this "timer" over? I changed the interval to 600 and submitted with the current API, which indicates success, however all of my devices are still disabled after reboot.

You need to restart HA Core.

rhoskins61 commented 2 years ago

That did the trick, thanks.

DERFAUSt commented 2 years ago

as of about 9am they are working...i put in my new api...set the poliing to 600.....restarted HA.....boom....gravy :).. i wish Govee would just give up some local control instead of just IoT cloud shite:)....the bastards....:)

ok.... im trying to put my head around this.... formula-wise..

there are 86,400 seconds in a day.... if the poling means how often the integration hits the device in seconds....ie if it is set to 10 then it will poll 86400s/10=8640hits/day....leaving 10000(limit)-8640=1360hits/day from 1 light......?

so if there are 2 lights....would that change that 8640hits/day to 17284 hits/day?.....sending you 7284 hits over your limit? ..from 2 lights and polling still set to 10..... ?

ok....on one light....if setting the polling to 600.... that would be 86400/600=144 hits a day to the api?......leaving 9856 additional hits that day?..... then 10 lights would be that 144x10=1440 hits/day?...leaving 8560 additional hits for the day?....

lol....one more....from a previous poster :)

7 lights....polling set to 120.... that would be....86400s/120poll=720 hits/day from one light.... 7 lights would be 720hits/day X 7 =5040hits/day....leaving 4960 available hits?

i appreciate everyone's time.... i hope my maths are right :)....

good times math on a saturday morning....there is a song in there somewhere.....