Govee integration

Haha thank you :smiley:
Iā€™ve overlooked that before.

Debugger is running with much more debug output, and breakpoint is waiting to be hit. Letā€™s catch this 429 :smiley:

Iā€™m off for today, good news for the evening is: tests for config flow are done, so the only untested code is the integration itself. Tomorrow Iā€™m not on my laptop, so donā€™t expect me :slight_smile:

1 Like

Latest version - please test this one ā€¦

ā€¦ test because itā€™s in the pull request to core/dev

Yay! :smiley:

1 Like

@LaggAt just wanted to say a big thank you. Ive just installed and tested the light and its working so far. I have the lightstrip for TV to give backlight with whatever is playing (H6104). Just got too test with the TV on.
I used the file set from today (23/9) in your GDrive.
This integration should make things so much better for my setup - currently I have Google Assistant Relay setup to work around the limitation - having to send a commands via that to the light from Node Red - convoluted but it worked lol

1 Like

Yea, i decided not to use these Node-Red scripts cause they made my head hurt. :joy:

1 Like

Got the newest version running and no errors! Looks great, thank you! Now if I can only get Govee to fix the color picker :smiley:

Hi,
Iā€™vea Govee H6104 and thanks to your plugin Iā€™m able to turn on and off the device via HA. Thank you!!

Just one question. Iā€™m using also the HA component emulated_hue to publish all my lights to logitech
Harmony remote.

On the remote I can comand the all the other lights except the H6104. I can see the H6104 but if I turn it on or foff using the remote nothing happens. Via web it works.

Have you any idea?
L

Ok, did some significant testing, everything is working great except for one thing. Home Assistant doesnā€™t seem to be converting back from the max 100 to the max 255 thing. The light is at max brightness in the screenshot: (model H6159)

Sample from log during brightness changes with debugging on:

2020-09-23 09:54:35 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_state 0D:D7:A4:Cx:xx:F1:xx:xC
2020-09-23 09:54:35 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 94 in 19.968635082244873 seconds
2020-09-23 09:54:35 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] state returned from API: {'data': {'device': '0D:D7:A4:Cx:xx:F1:xx:xC', 'model': 'H6159', 'properties': [{'online': True}, {'powerState': 'on'}, {'brightness': 19}, {'color': {'r': 0, 'b': 255, 'g': 0}}]}, 'message': 'Success', 'code': 200}, resulting state object: GoveeDeviceState(device='0D:D7:A4:Cx:xx:F1:xx:xC', model='H6159', online=True, power_state=True, brightness=19, color=(0, 0, 255), timestamp=1600869275.490458, source='api')
2020-09-23 09:54:37 DEBUG (MainThread) [custom_components.govee.light] async_turn_on for Govee light 0D:D7:A4:Cx:xx:F1:xx:xC, kwargs: {'brightness': 255}
2020-09-23 09:54:37 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] control 0D:D7:A4:Cx:xx:F1:xx:xC: {'name': 'brightness', 'value': 100}
2020-09-23 09:54:37 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 93 in 18.049241065979004 seconds
2020-09-23 09:54:37 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_state 0D:D7:A4:Cx:xx:F1:xx:xC
2020-09-23 09:54:37 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] state object returned from cache: GoveeDeviceState(device='0D:D7:A4:Cx:xx:F1:xx:xC', model='H6159', online=True, power_state=True, brightness=254, color=(0, 0, 255), timestamp=<bound method Govee._utcnow of <govee_api_laggat.govee_api_laggat.Govee object at 0x7f61f1a79580>>, source='history')
2020-09-23 09:54:45 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_state 0D:D7:A4:Cx:xx:F1:xx:xC

Iā€™m actually seeing the same thing for brightness. Using H6163.

1 Like

I sent an email to the API team requesting mode selection via API and pointed out the the H6104 does not give a response listing available commands like the other models do.

FYI there are four modes for the H6104:
Music
Video
Color
Scenes

I did not get a chance to test the newest component version yesterday, hopefully, I will get some time today to test it.

1 Like

Iā€™m running HA115.2 and have unzipped the files to the custom_components\govee folder but I do not see it in the list of integrations to add. I have rebooted several times and can see in the log file the ā€œnormalā€ error message - ā€œYou are using a custom integration for govee which has not been tested by Home Assistantā€¦ā€ so I know it is reading it correctly. Anything else I have to do to configure it? I have my API key ready.

It could take a few minutes for it to fully load up the first time.
I have this issue in the past that once something new is installed in Home Assistant that it could take (me) 12 minutes to have an fully operation HA; but all further reboots are faster.

1 Like

I know your waiting on approval which is probably why this doesnā€™t work yet but just in case:
The documentation link does not work:

https://www.home-assistant.io/integrations/govee

@LaggAt. I just wanted to take a second to THANK YOU for your amazing work on this integration. Because of you I ordered a 2nd H6159 for another TV. Having them in Home Assistant, being able to use automations, being able to have on while the TV is off, etc. is an awesome upgrade from my older tiny remote only, USB powered strips.

PS Did a quick test and the 2nd one showed up perfectly in Home Assistant after reloading the integration, using the name I gave it in the app. Beautiful workā€¦

1 Like

sorry, I do not have nor know anything about publishing to the harmony.

you have to wait for hass istalling the Pypi package, which may take some time somehow. after that you could add a new integration, and enter your api key.

The delay should be gone as soon as we have this as component included in core - then there will be a requirements_all.txt pulling the package into the docker image. In the meanwhile we have to wait.

yea thanks, I got a mail today i have to start a pull request there too ā€¦ I thought I could do that afterwards.

pull request is missing documentation, and failing python 3.7 (which i also didnā€™t know it is tested and enabled my tests for 3.8 only), Iā€™ll work on that this weekend.

Thank you for your testing :slight_smile:
Iā€™ll probably order more too - just keep in mind that we have that 60 requests per minute limit, and we have to poll every device separate. I did ask govee for a solution for people having more than one, and they are planning a single poll for multiple states which could be easily implemented in the structure of the integration. They plan this for 2021.

In the meantime take care your poll interval is high enough, otherwise the library will stop api connections at the end of this 60s period, which is not nice when you want to control it then.

1 Like

so for H6159
Iā€™m not totally clear what I am seeing ā€¦
Screenshot shows brightness at about 40%.
on 09:54:37 i see home assistant to control brightness to 255 (hass is using 1-255), so 100%.
next we call the api with the value 100

as we expect some models on govee using a range of 0-100, others a range of 0-254, we should get around 40% light, or 100% light in the room. What do you see?

on 09:54:37 you see a state - but this is a state I generate in the library, not one that is coming from the API ā€¦ could you wait a bit longer for a state from the api to see what brightness govee tells us then? watch for a ā€œstate returned from APIā€ debug line.

Hope I understood you right, but I need that bit of input.
When I got govee api support right we always get state information from 0-254, and +1 it for home assistant. The difference should be on the control side.

So when I did this capture, I had just slid the brightness slider all the way up. Light was at 100% brightness in the room. After HA received the status from the API, the slider moved back to the position shown in the screenshot.

In other words every time I slide the slider all the way up, after around 10 seconds it will jump back down to the 40% or so mark. The conversion back doesnā€™t seem to be happening.

1 Like

Iā€™ll look into that on the weekend. Maybe we should have a possiblility to configure this somewhere? Seems a bit random from the api. Any idea where such configs would fit in home assistant? Well maybe I should just hard code it.

1 Like