I’ve sent a report to the support; let’s hope they will fix it.
BTW a couple of day after my mail now the result of a status query is:
“This device model does not support query device state”
So they have removed the compatibility on H6104…
I’ve sent a report to the support; let’s hope they will fix it.
BTW a couple of day after my mail now the result of a status query is:
“This device model does not support query device state”
So they have removed the compatibility on H6104…
Govee support team just reply
After actual testing, we found that the H6104 device cannot normally report the device status to the server. So we decided to set H6104 to not be able to query the device status. We are sorry for that.
If you can, you can try to store the latest state of the device locally.
So I wonder how to just store status in Home Assistant without query the device status.
That’s a real pain.
I’ve just started to set up a Pi with Hyperion to give me the backlight and ditch the Govee altogether. (no need for the camera now either).
This has confirmed my decision.
Thanks for this code mate, after a lot of head scratching trying to figure out why the state won’t update in Home Assistant I realised the mac address in the sensor resource url needs to be written with %3A instead of : and without the brackets also as someone else said above I had to query the mac address as the one they had was different to the on my router has. example of how I had to lay out the code to get the state updating: now if only we could figure out how to control the colour via the api.
- platform: rest
name: bed_led_sensor
method: GET
resource: https://developer-api.govee.com/v1/devices/state?device=**%3A**%3A**%3A**%3A**%3A**%3A**%3A**&model=H6117
I’ve been working on this and I can see the light and the status, but I’m having trouble controlling it. This is what I have so far:
sensor:
- platform: rest
name: tv_light_sensor
method: GET
resource: https://developer-api.govee.com/v1/devices/state?device=XX%3AXX%3AXX%3AXX%3AXX%3AXX%3AXX%3AXX&model=H6163
headers:
Govee-API-Key: my api key
Content-Type: application/json
User-Agent: Home Assistant REST sensor
scan_interval: 10
json_attributes_path: '$.data'
json_attributes:
- properties
value_template: '{{ value_json.data.properties[0].online }}'
- platform: template
sensors:
tv_light_state:
value_template: "{{ state_attr('sensor.tv_light_sensor', 'properties')[1].powerState }}"
entity_id: sensor.tv_light_sensor
tv_light_brightness:
value_template: "{{ state_attr('sensor.tv_light_sensor', 'properties')[2].brightness }}"
entity_id: sensor.tv_light_sensor
tv_light_color:
value_template: "{{ state_attr('sensor.tv_light_sensor', 'properties')[3].color }}"
entity_id: sensor.tv_light_sensor
light:
- platform: template
lights:
tv_light_strip:
friendly_name: "TV Light"
value_template: >-
{% if is_state('sensor.tv_light_state', 'on') %}
{% if states('sensor.tv_light_brightness') | int < 1 %}
off
{% else %}
on
{% endif %}
{% else %}
off
{% endif %}
level_template: >-
{% if is_state('sensor.tv_light_state', 'on') %}
{{ (((states('sensor.tv_light_brightness') | int) / 255) * 100) | round(0) }}
{% else %}
0
{% endif %}
turn_on:
service: rest_command.tv_light_power
entity_id: light.tv_light_strip
data:
value: "on"
turn_off:
service: rest_command.tv_light_power
entity_id: light.tv_light_strip
data:
value: "off"
set_level:
service: rest_command.tv_light_brightness
entity_id: light.tv_light_strip
data_template:
brightness: >
{{ (brightness /255*100) | int | round(0) }}
rest_command:
tv_light_power:
url: https://developer-api.govee.com/v1/devices/control
method: PUT
content_type: 'application/json'
headers:
Content_Type: application/json
Govee-API-Key: my api key
User-Agent: Home Assistant REST sensor
payload: '{ "device": "XX:XX:XX:XX:XX:XX:XX:XX", "model": "H6163", "cmd": { "name": "turn", "value": "{{value}}" } }'
tv_light_color:
url: https://developer-api.govee.com/v1/devices/control
method: PUT
content_type: 'application/json'
headers:
Content_Type: application/json
Govee-API-Key: my api key
User-Agent: Home Assistant REST sensor
payload: '{ "device": "XX:XX:XX:XX:XX:XX:XX:XX", "model": "H6163", "cmd": { "name": "color", "value": {"r": 255, "g": 255, "b": 255}} }'
tv_light_brightness:
url: https://developer-api.govee.com/v1/devices/control
method: PUT
content_type: 'application/json'
headers:
Content_Type: application/json
Govee-API-Key: my api key
User-Agent: Home Assistant REST sensor
payload: >
{ "device": "XX:XX:XX:XX:XX:XX:XX:XX", "model": "H6163", "cmd": { "name": "brightness", "value": {{ brightness }} } }
EDIT: I got it working. I think I was missing spaces in {{ value }}
.
I think colors are broken? No matter what I change the color to in the app, the RGB values stay the same (and Identical to each other). If I change brightness in the app, the brightness value changes almost immediate.
Hi, fyi I’m implementing an integration.
Code is here:
Lib: https://github.com/LaggAt/python-govee-api published https://pypi.org/project/govee-api-laggat/
Integration: https://github.com/LaggAt/home-assistant-core/tree/feature/govee-led-strips/homeassistant/components/govee
For now i started with on/off switch and status.
Not done so far: other commands, tests, logo.
For the coders here feel free to comment on my work. Thanks.
Nice! I pulled down the .zip and installed it as a Custom Component in the latest 0.115.0. On/Off working perfectly, nice work so far!
Hi, can you explain the steps to use it as a custom component? This didn’t work for me yesterday. Thanks.
I downloaded the zip from here: https://github.com/LaggAt/home-assistant-core/archive/feature/govee-led-strips.zip
I extracted only the Govee folder under Components and placed it here:
I rebooted and went to Configuration --> Integrations and clicked Add. Govee was in the list, being picked up from the Custom Component.
I didn’t wait long enough. Is it taking longer to start up the first time only?
Doesn’t seem that long, although I did catch this in the log, perhaps it wants to install it every time?
2020-09-18 14:45:57 INFO (SyncWorker_13) [homeassistant.util.package] Attempting install of govee-api-laggat==0.0.11
Yes, probably the docker container disposes that. Well - other work in prioritized.
Hi, I have followed [pmd5700] method I can now turn on and off my govee led strips. It took about ten minutes before the govee integration was displayed in the list of possible integrations. Thank you for your work on this, I love that I can now turn these strips on and off.
I have the govee custom integration and it found my h6104 set but continues to say unavailable and will not allow me to change state. I recall from a previous post that someone said the h6104 won’t give a response back on the state; it appears that I can not send even the on command. So, am I correct in assuming that I will not be able remotely turn my Govee set on remotely?
I just released a version with on/off, color, color temp and brightness, and some readonly attributes for api rate limits.
You may use the same procedure as last time. I prepared a zip containing just the govee folder to be put into custom_components, here:
https://drive.google.com/drive/folders/1f2yVik5n-3-_1Hwxgywn1TlExyau5TxM?usp=sharing
Hi, I have no h6104, but the previous version had no idea of an “unavailable” state. So I assume the custom integration crashed somehow.
Could you try the new zip, and if it still fails: watch for logs?
Just did, and same result status indicates unavailable. I don’t think it is the integration crashing; I don’t think Home Assistant can get the status of the state. I think it was this discussion but it could have been another where someone stated that Govee API did not return the status of the state.
Ok, it was this discussion. It looks like that Govee removed support for the h6104 to get state status. It appears if I might be able to send an on or off command but not thru the integration and just not get any status of the state.
Could you use Postman (or curl, whatever) to try the requests manually?
Replace:
40:83:00:00:00:00:00:00 with your device id, and
YOUR_API_KEY with your api key
H6163: your model
You need a Header (name: value) for every request:
Govee-API-Key: YOUR_API_KEY
for device list do a GET request on
https://developer-api.govee.com/v1/devices
for device state do a GET request on
https://developer-api.govee.com/v1/devices/state?device=40:83:00:00:00:00:00:00&model=H6163
to turn on do a PUT request on
https://developer-api.govee.com/v1/devices/control
in the Body you need to post this json payload:
{
"device": "40:83:00:00:00:00:00:00",
"model": "H6163",
"cmd": {
"name": "turn",
"value": "on"
}
}
Maybe we should keep this thread clean, so feel free to file an issue on my fork of home assistant core here https://github.com/LaggAt/home-assistant-core/issues. You might want to post the results you get from these requests. Take care not to post secrets as your API key.