Govee integration

Hi, think that is related to another field in the options, could you try to enter a space in the ‘DISABLE state updates’ text box on the bottom? It seems it doesn’t allow empty strings, I’m still fiddling with the validator here.

Could you provide debug logs when it becomes unavailable? See first post for instructions.

Thanks @LaggAt . That worked for setting the “When a led is offline, show it as off (default doesn’t change state). Default: False”. I will post the logs when it next becomes unavailable.

1 Like

Hi @LaggAt see below copy of my log from the time it goes from being online to offline as seen in the log. The light is still connected to wifi as seen in the govee app and once turned on in the app the light reappears in HA.

021-05-06 01:01:15 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] state returned from API: {‘data’: {‘device’: ‘XXXX’, ‘model’: ‘H6199’, ‘properties’: [{‘online’: True}, {‘powerState’: ‘off’}, {‘brightness’: 50}, {‘color’: {‘r’: 255, ‘b’: 255, ‘g’: 255}}]}, ‘message’: ‘Success’, ‘code’: 200}, resulting state object: GoveeDevice(device=‘XXXX’, model=‘H6199’, device_name=‘living_room_tv_light’, 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=127, color=(255, 255, 255), color_temp=0, timestamp=1620226875.31712, source=<GoveeSource.API: ‘api’>, error=None, 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)
2021-05-06 01:01:15 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.314 seconds
2021-05-06 01:01:19 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/config/custom_components/fronius_inverter/sensor.py”, line 319, in async_update
await self._update()
File “/config/custom_components/fronius_inverter/sensor.py”, line 367, in _update
self._data = (await self.fetch_data(self._build_url()))[‘Body’][‘Data’]
File “/config/custom_components/fronius_inverter/sensor.py”, line 335, in fetch_data
response = await self._session.get(url, timeout=10)
File “/usr/local/lib/python3.8/site-packages/aiohttp/client.py”, line 619, in _request
break
File “/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py”, line 656, in exit
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/config/custom_components/fronius_inverter/sensor.py”, line 116, in fetch_data
await fetcher.async_update()
File “/config/custom_components/fronius_inverter/sensor.py”, line 322, in async_update
except asyncio.TimeoutError:
NameError: name ‘asyncio’ is not defined
2021-05-06 01:01:19 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/config/custom_components/fronius_inverter/sensor.py”, line 319, in async_update
await self._update()
File “/config/custom_components/fronius_inverter/sensor.py”, line 381, in _update
self._data = (await self.fetch_data(self._build_url()))[‘Body’][‘Data’][‘Site’]
File “/config/custom_components/fronius_inverter/sensor.py”, line 335, in fetch_data
response = await self._session.get(url, timeout=10)
File “/usr/local/lib/python3.8/site-packages/aiohttp/client.py”, line 619, in _request
break
File “/usr/local/lib/python3.8/site-packages/aiohttp/helpers.py”, line 656, in exit
raise asyncio.TimeoutError from None
asyncio.exceptions.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/config/custom_components/fronius_inverter/sensor.py”, line 116, in fetch_data
await fetcher.async_update()
File “/config/custom_components/fronius_inverter/sensor.py”, line 322, in async_update
except asyncio.TimeoutError:
NameError: name ‘asyncio’ is not defined
2021-05-06 01:01:20 ERROR (MainThread) [custom_components.fronius_inverter.sensor] Failed to update: connection error
2021-05-06 01:01:25 DEBUG (MainThread) [custom_components.govee.light] _async_update
2021-05-06 01:01:25 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] get_states
2021-05-06 01:01:25 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] Rate limit total: 100, remaining: 99 in 59.786585092544556 seconds
2021-05-06 01:01:25 DEBUG (MainThread) [govee_api_laggat.govee_api_laggat] state returned from API: {‘data’: {‘device’: ‘XXXX’, ‘model’: ‘H6199’, ‘properties’: [{‘online’: ‘false’}, {‘powerState’: ‘off’}, {‘brightness’: 50}, {‘color’: {‘r’: 255, ‘b’: 255, ‘g’: 255}}]}, ‘message’: ‘Success’, ‘code’: 200}, resulting state object: GoveeDevice(device=‘XXXX’, model=‘H6199’, device_name=‘living_room_tv_light’, controllable=True, retrievable=True, support_cmds=[‘turn’, ‘brightness’, ‘color’, ‘colorTem’], support_turn=True, support_brightness=True, support_color=True, support_color_tem=True, online=False, power_state=False, brightness=127, color=(255, 255, 255), color_temp=0, timestamp=1620226885.352289, source=<GoveeSource.API: ‘api’>, error=None, 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)
2021-05-06 01:01:25 DEBUG (MainThread) [custom_components.govee.light] Finished fetching govee data in 0.351 seconds
2021-05-06 01:01:28 ERROR (MainThread) [homeassistant.components.wled] Error fetching wled data: Invalid response from API: Timeout occurred while connecting to WLED device at 192.168.1.35

1 Like

@LaggAt
First of all your integration is awesome!
Using govee immersion (h6199) and since the last update having same unavailable issues on home assistant.

Tried wake up on lan method without luck.
The only fix for me is to open govee app, and the device then available again on home assistant.

Is there any walkthrough I need to do?

1 Like

I ignore the asyncio errors from custom_component fronius_inverter, they do not relate to us.
Hi, wonder what it causes you got that offline response from the API, havn’t seen that on my site. Seems their state is wrong in API, Govee Home can still use them because of the BLE support.

Seems to be the same issue here, led reporting offline here.

I would suggest the following:

  • make sure there are no network issues hindering the Govee lights to reach internet.
  • make sure the device isn’t really off (power failure, e.g. a TV as power source)
  • once this is eliminated as issue, as a workaround try to ignore ‘online’ state updates from API, you do this on the Govee integration using the ‘Configure’ button, and enter this “DISABLE state updates” as seen in the last row here:
    image

This may work, but please consider this a workaround. If you have issues your light is reporting wrong state from Govee API you should contact Govee Support on that and ask for a fix on this.

Kindly tell me if the hints here help you.

Call to all the coders here…

do you have an solution to this behavour? (click link below)

I must miss something, but I don’t get it.

Thanks for your quick reply!

Govee is connected to the internet, also check that on my router settings and power on.

I did what you wrote (add “api:online”) and restarted home assistant.
Govee was still unavailable.

I turned off Bluetooth on my phone and lunch the govee app. Then govee become available again.

Now I need to wait a few hours to see if this fixed the problem… Will let you know!

1 Like

Thanks @LaggAt I checked the wifi connectivity and did not observe any drop in connection. I have also checked the power supply and did not did not any problems. I have now disbaled api:online and will monitor if that fixes the problem.

1 Like

Please also report this to Govee api support, use the mail address in the mail you got the API key. They 're very helpful, think they can help more than just this workaround.

How would I add multiple API keys? I have a Govee account for my lights and then I want my brother to have his own account to control his lights. They are all on the same WiFi network so how would I go around doing this?

1 Like

Thanks @LaggAt I have reported this bug to Govee.

1 Like

Hi @LaggAt see response below received from Govee

"am sorry for the inconvenience caused.

“online” is implemented through the cache;sometimes it might return wrong state.

We suggest that the third-party developers to ensure that even if online returns “false”, the users are allowed to send control commands. So even the cache is wrong, users can still control the device.

We will also update the firmaware to improve it in the future, but it would take around 1 month.

Can you please wait for the firmware update to improve it?"

So seems like your workaround is the way to go till a new firmware is rolled out in a month.

Hi, currently this isn’t supported. I recommend using one account - they should be available in one Home Assistant installation anyhow. Also API limits apply by IP address.

Yes, I already got that answer on other requests, think this will not work out.
A 3rd party library has no chance to figure out the state then by looking at the API. If something else is turning the lights (hardware button, Govee Home) our state will be wrong. So I need to trust the API.

Hmm…so unlikely that Govee will be updating their api then.

1 Like

I think there was some change causing this issues, API was always correct a month ago.

If we can describe issues why the state is wrong and go beyond that first blocking mail we will have success. It was always good to work with them, sometimes it took 2 or 3 mails.

They have said that their new api document will be released next week. :crossed_fingers:

1 Like

Uh, exciting :slight_smile:

Hey @LaggAt
After two days that I thought the problem solved the bug came back.

What exactly you want me to write to govee support team?

1 Like

So I’ve been informed, the new API document is ready, I requested it.