Govee integration

Clarification,
The ‘on’ command does turn it on, however, regardless of what brightness is set to the LEDs are off until I do some other action such as hit video mode in the app or select a color for HA.
I had the app open and I could see that it turned on the Govee LED and said brightness was at 70% but they were not actually on until I did something else. If I turn it on from the app then it functions as it previously did.
I could not find anything in the logs concerning Govee.
I will revert to the previous revision and report result.

2 Likes

Actually @LaggAt is working on getting it at a integration into HA proper.

1 Like

Thanks. Did you see my post about debug logs?

Yes, just have not got that far yet. Fatherly duties get in the way from time to time.

1 Like

Take your time. Just copy the block as-is into your configuration.yaml, and you will have any detail in the debug logs. I really wonder what causes that issue.

Reverted to previous version and it functions as expected for the H6104.
I will turn on debug and try the newest and get back to you.

My wife initially didn’t like all the automatons, but when they don’t work…she really doesn’t like it. I put the Govee lights on our bedroom TV and she likes that they just turn on and off all by themselves when the TV goes on and off.

I should be able to try this out after I attempt removal of a wasp nest from my bathroom vent duct. (Don’t wait, it might take awhile)

1 Like

For the on; it turns ‘on’ but no light until I make a change; I may try an automation to change the brightness after it turns on. I have it set to 70% but it goes to 69%, no big deal but it used to be exact.

2020-10-05 17:05:25 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-05 17:05:25 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-05 17:05:25 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-05 17:05:25 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 99:XX:XX:XX:XX:XX:XX:XX, kwargs: {'brightness': 178}
2020-10-05 17:05:25 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'brightness', 'value': 69}
2020-10-05 17:05:26 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 99 in 59.91365694999695 seconds
2020-10-05 17:05:35 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-05 17:05:35 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states

for off:

2020-10-05 17:06:15 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-05 17:06:23 DEBUG (MainThread) [custom_components.govee.light] async_turn_off for Govee light 99:XX:XX:XX:XX:XX:XX:XX
2020-10-05 17:06:23 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'turn', 'value': 'off'}
2020-10-05 17:06:23 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 98 in 2.3401288986206055 seconds
2020-10-05 17:06:25 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-05 17:06:25 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states

Nothing really stands out in the logs.

Ok, it seems that Govee was changing the API as I was testing. Even with older versions of your integration, the only way I can get it to turn on and actually be on is to set brightness to “0” then it will turn on in the last brightness state.

2020-10-05 18:36:16 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 99:XX:XX:XX:XX:XX:XX:XX, kwargs: {}
2020-10-05 18:36:16 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'turn', 'value': 'on'}
2020-10-05 18:36:16 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 98 in 44.95530104637146 seconds

So, for at least the H6104, for now it will not accept a brightness command for the initial turning on. Once it is truly on then the brightness can be adjusted in HA.
I will try again tomorrow and see what the results are.
The brightness commands in the automation for device don’t appear to actually do anything for the H6104…something is strange and I don’t think it is entirely your integration.

2020-10-05 18:30:55 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'brightness', 'value': 69}
2020-10-05 18:30:55 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 98 in 58.13555598258972 seconds
1 Like

Yes, that’s expected.
Home Assistant is setting in a Range from 1-255, Govee is using 0-254 or 0-100.
So I decided to handle it in the client library in 0-254 (integration does the -1 / +1 either way), and if you do the math you cannot set it to 70 exact. It doesn’t really matter, but I try to clarify that once:

hass sets: 70, calls client with 70-1

client transforms 69 form the range 0-254 for your lamp to 0-100: 
70 * 100 // 254 == 27 (this is floored from 27.17)

next result if nothing changed from govee will be 27 in the 0-100 range (again, for your lamp)
we transform the range back to 0-254
27 * 254 // 100 = 68 (floored from 68.58)

integration will add +1 again to represent this in 1-255 range, so we end up with:
69

Here I see no on command - just setting the brightness, right?

What is the log for turning it on, and waiting for the next state from govee? And what happens to your led while doing so? (Please wait with copying the logs until you get a state from API)

H6160 is working minus the color temperature (warm white/cold white)

1 Like

Thank you, added to the details on first post.

@LaggAt I think you meant to add H6160 to the line that had H6104; it looks like you took the H6104 off the list.
I should get a chance tomorrow to retry the newest and get you the logs.

1 Like

Thanks, fixed the line break. That would be great, I really want to see how they behave. As soon as we know that we could think about possible solutions :slight_smile:

Hey mate finally got a chance to try the new silver pr. So far everything working as it should on this end, so can confirm H6117 is all good.

1 Like

Thank you, I added that information to the first post.

Buy Me A Coffee

Just wondering … is anyone here seeing this strip on the Raspberry’s bluetooth?

hcitool scan

Didn’t show a thing.
Not saying I do something here.

@LaggAt

Ok, I have some info:
For the H6104
With any value in brightness for the on command in automation it will only send the brightness command and not the turn on command. (My logs were previously correct in showing that, I just didn’t put it together.)
If the brightness amount is changed in the automation then only brightness is sent unless it is set to zero…if “0” is ever typed in then it will send the “off” command even if it is supposed to be the on. The only way to get it to come on with automation is to not ever type anything in the brightness box. If I do, then I have to re-select the govee device and start with a new zero prefilled in.
If I don’t set it then it will turn on to the previous value that the govee was set to when it was turned off.

Sorry for the delay but I had issues with version 0.116 it is better with 0.116.2

I don’t know if it is just the H6104 in the automation section or if other might have this issue and just have not come across it yet.

# Off command via automation

2020-10-11 14:52:14 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:52:14 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 14:52:14 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 14:52:24 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:52:24 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 14:52:24 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 14:52:34 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:52:34 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 14:52:34 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 14:52:39 DEBUG (MainThread) [custom_components.govee.light] async_turn_off for Govee light 99:XX:XX:XX:XX:XX:XX:XX
2020-10-11 14:52:39 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'turn', 'value': 'off'}
2020-10-11 14:52:40 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 99 in 59.915022134780884 seconds
2020-10-11 14:52:44 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:52:44 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 14:52:44 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 14:52:54 DEBUG (MainThread) [custom_components.govee.light] _async_update

# On command via automation brightness at default "0"

2020-10-11 14:55:24 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:55:24 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 14:55:24 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 14:55:27 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 99:XX:XX:XX:XX:XX:XX:XX, kwargs: {}
2020-10-11 14:55:27 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'turn', 'value': 'on'}
2020-10-11 14:55:29 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 99 in 59.912209033966064 seconds
2020-10-11 14:55:35 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:55:35 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 14:55:35 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 14:55:45 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 14:55:45 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states

# On command via automation brightness set to "100"

2020-10-11 15:06:36 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 15:06:36 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 15:06:45 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 99:XX:XX:XX:XX:XX:XX:XX, kwargs: {'brightness': 255}
2020-10-11 15:06:45 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'brightness', 'value': 100}
2020-10-11 15:06:46 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 15:06:46 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 15:06:46 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 15:06:46 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 99 in 59.91592621803284 seconds
2020-10-11 15:06:56 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 15:06:56 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states

# On commnad via automation, brightness set to "10"

2020-10-11 15:16:17 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 15:16:17 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 15:16:17 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 15:16:21 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 99:XX:XX:XX:XX:XX:XX:XX, kwargs: {'brightness': 26}
2020-10-11 15:16:21 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'brightness', 'value': 9}
2020-10-11 15:16:24 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 99 in 59.9130220413208 seconds
2020-10-11 15:16:27 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 15:16:27 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states

# On Command via automation with Brightness set to "0"

2020-10-11 15:23:29 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 15:23:29 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 15:23:31 WARNING (MainThread) [homeassistant.config_entries] Config entry for kodi not ready yet. Retrying in 80 seconds
2020-10-11 15:23:33 DEBUG (MainThread) [custom_components.govee.light] async_turn_off for Govee light 99:F8:78:9C:E7:0A:22:DC
2020-10-11 15:23:33 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:F8:78:9C:E7:0A:22:DC: {'name': 'turn', 'value': 'off'}
2020-10-11 15:23:37 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 98 in 34.37687706947327 seconds
2020-10-11 15:23:39 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 15:23:39 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 15:23:39 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
1 Like

So you are using an automation? Could you share this automation too?
Also could you edit your post and comment what you did at the exact moment of the log and what you expect to happen, and what happened on the led? There is switching on and off, setting brightness, but I need to know when these things happen and what was the expected output.

I want to answer a bit more detailed on the PC, so what do we know now:

This is correct.Setting Brightness does only set brightness in the api.

Well, brightness == 0 is basically OFF, but it should send brightness=0. Again, your description without corelation to the log lines confuses a bit, please comment your log with facts as your go along.

I also do not know what it is - so please comment your log. This is an example, I just copied some log lines th show what I mean :slight_smile:

# here i did turn brightness to 255, the light turned on at max brightness:
2020-10-11 15:06:36 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2020-10-11 15:06:36 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.000 seconds
2020-10-11 15:06:45 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 99:XX:XX:XX:XX:XX:XX:XX, kwargs: {'brightness': 255}
2020-10-11 15:06:45 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 99:XX:XX:XX:XX:XX:XX:XX: {'name': 'brightness', 'value': 100}
2020-10-11 15:06:46 DEBUG (MainThread) [custom_components.govee.light] _async_update
2020-10-11 15:06:46 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states

# then I did set brightness to 0, light stayed on this happened in logs:
.....

Thank you.