Govee integration

Hi, thanks for the logs @drewHA, I’ll try to find some time until weekend.

Could one of you also add switching light on/off and setting brightness to different levels?
Also if you can delete the learning yaml, and restart home assistant, please provide logs of the brightness set to 100% afterwards, there should be some log lines showing learning information.

Thanks.

We have usage stats!

Hi guys, I need your help.

To show the significance of the integration when talking to support I longed for installation statistics. Thanks to Home Assistant Analytics and some scripts finally this is possible.

For this, would you mind to enable analytics in your installation?
we would need Usage Analytics
To enable, go here: https://my.home-assistant.io/redirect/general (or go to your “General Settings”)

This leads to a stronger position for us when talking to the manufacturer.
Thanks a lot!

installation count per version

edit: picture is cached here, if you want to see the current usage use this link:
https://raw.githubusercontent.com/LaggAt/actions/main/output/goveestats_installations.png

2 Likes

So I found out what the issue was. First, you have to install HACS. This allows you to use community integrations. You can find many tutorials on youtube. Once there you can find the govee integration.

1 Like

as I know they need BLE, so one step at the time :slight_smile:

1 Like

I did overlook your question, yes you need HACS. Hacs is great for developers and users, deployment of new features is easy and installing updates is a click away.

I’ll try and revisit tomorrow afternoon. Its tough to troubleshoot in the kid’s room; I seem to have more time when he’s asleep in there.

My brightness on full has been working well since setting the set and get to 100 in the learning file. But i’ll delete the learning file, then restart and turn on many times to get some reproducible results for you - at least on my system.

I also set my analaytics to on for you. Tally up another one - I didn’t know I had to do that, thanks for pointing that out.

1 Like

I posted my updates in the issue that I opened on github. I opened it in the python library and not the HACS repo - wasn’t sure which one was the best fit… happy to give you more info if you need it. Let me know how I can help!

Thanks for the informations, especially because this is in the kid’s room.

Oh great, I’ve never seen negative brightness values. So I need a new plan for auto-learning :slight_smile:

I’m still a bit confused what this device expects.

  • -4 (or -11 according to a post above) seems to be the lowest the app is setting.
  • 254 is unsupported, so the max value must be lower. Up to know this indicated max value is 100, but who knows. According to the 40% issue the correct value must be somewhere around 254, maybe the whole range is -4 to 250. Don’t know why they change this with every model.
  • if -4 is already powered on, there may also be a brightness of -5 for off. I also need to consider this in the logic assuming the device is on/off after a control command.
  • maybe the negative values are some special values, the app uses for something. A lot of question marks appear here.

Think before digging into the code, I’ll try to contact Govee API support on that, to get some light on that issue :smiley:

Well, you don’t have to, but I apprecate that alot.I hope to get some API features with this backing stats. Thank you.

How did you pull out your integration?
I did not see Govee listed nor would it come up in search on the analytics page, but I also don’t see HACS either.
https://analytics.home-assistant.io/#integrations

1 Like

I was playing with it a bit more. This time via google. I was successfully able to control the brightness via the google home app. Whatever I set to it using google, it was spot on in the govee app, 49% in google, 49% in govee. This was not the case in HA, though it was not off by much.

When I set the brightness to 1% via google I get the same -4 / -11 in the HA logs. I suppose this is good that I am seeing some consistency.

1 Like

There is a json having all custom integrations,
https://analytics.home-assistant.io/custom_integrations.json

I grab this daily using a Github action and script:

Yes, still wonder why -4 or -11, this is a bit inconsistency if there is no difference.
Govee answered with a new API doc v1.3, which just has some reformatting and some new models listed. So I sent them a second mail.

Models added as untested in first post.

The second and only other change (some spaces and reformatting ignored) is we get allowed color temperature values with (some?) devices. If available I want to use them, here is a feature request for later: Read allowed color temperature values from API · Issue #33 · LaggAt/hacs-govee · GitHub

Hi Florian,

I lost power and now my states are showing inverse on Home Assistant. When the LED is on, it shows off in Home Assistant and when it is off, it shows On in Home Assistant.

I tried powering them on on the app with it showing as on on Home Assistant, changing the Configuration to:

API:online;HISTORY:online

and reboot, but it is still showing the inverse of what it should be.

1 Like

Just saw we get no status from Govee API currently. Shouldn’t be a big issue for the integration as we manage a state locally. I just informed Govee api support.

To provide a quick view if the Govee API is running normally I did a graph.

It tests every 30 minutes:

  • get_devices(): this returns a list of devices registered
  • get_states(): this gets the state for every device

for both i plot a ‘+’ sign, if the request was answered correctly, or a dot if the request failed somehow.
This does test the functionality of the library, AND Govee API. Both must work.

You could always find a current graph here (click).

Greetings, Florian.

In Govee integration’s Options, try:

API:power_state

you may also want to disable the two-button-View, so that the history state is shown final:
image

You don’t want to ignore the online state, which just tells if the device is online. Instead you want to ignore the power_state if coming from API, there is an issue we get no state currently.

1 Like

Thanks. I tried that and still reporting inverse.

I will try in a couple hours

1 Like

Just for clarification: with this option, we only use assumed state - this is the state we remember when we switch something. If you switch with another application, e.g. Govee Home, we do not know that with that option.

If you still think this is an error - could you provide debug logs while switching your light on using Home Assistant? Would be interesting to see which state you get from where, and why the integration thinks the light is off.

edit: ah yes, and maybe provide screenshots what the UI shows.

Thanks, Florian.

2021-08-09 12:07:12 DEBUG (MainThread) [govee_api_laggat.api] state object returned from cache: GoveeDevice(device='21:XX:XX', model='H6110', device_name='Stair Lighting', 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=0, color=(0, 0, 0), color_temp=0, timestamp=1628528832.746216, source=<GoveeSource.HISTORY: 'history'>, error='API-Error 500: {"message":"service is busy please try again later","status":500}', lock_set_until=1628528833.317072, lock_get_until=1628528834.317081, learned_set_brightness_max=None, learned_get_brightness_max=254, before_set_brightness_turn_on=False, config_offline_is_off=False), next state for 21:XX:XX from api allowed in 1.5709519386291504 seconds
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for 69:XX:XX: API-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for E7::XX:XX: API-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for ED::XX:XX: API-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for 70::XX:XX API-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for 6C::XX:XXAPI-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for F5::XX:XXAPI-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for 74::XX:XX API-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 WARNING (MainThread) [custom_components.govee.light] update failed for 10::XX:XX API-Error 500: {"message":"service is busy please try again later","status":500}
2021-08-09 12:07:12 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.743 seconds
2021-08-09 12:07:14 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 21::XX:XX, kwargs: {}
2021-08-09 12:07:14 DEBUG (MainThread) [govee_api_laggat.api] control 21:XX:XX {'name': 'turn', 'value': 'on'}
2021-08-09 12:07:15 DEBUG (MainThread) [govee_api_laggat.api] Rate limit total: 100, remaining: 91 in 27.099934816360474 seconds

govee

1 Like

Is the state correct after switching on? The log shows events before the switch command, not after.

How does the light in lovelace look like?