Page 1 of 1

Govee support

Posted: Thursday 02 February 2023 10:58
by galadril
Is there someone with Govee lights that knows if there is already a Govee Domoticz Python plugin?
They have multiple connection options:

1) There is a public api (you can request api key from the Govee app)
https://govee-public.s3.amazonaws.com/d ... erence.pdf
But this has some tights limits on numbers of calls.

2) Govee also has an Local API within your network:
https://app-h5.govee.com/user-manual/wlan-guide

There are already some Home Assistant plugins available, so others are already exploring the options:
https://github.com/wez/govee-lan-hass
https://community.home-assistant.io/t/g ... api/460757

What do you think??

EDIT: Created a first version of a python plugin
https://github.com/galadril/Domoticz-Govee-Plugin

Re: Govee support

Posted: Friday 03 February 2023 4:15
by abductor
Interesting, I didn't know about option 2.

I've been using option 1, the public API. I just have domoticz send HTTP web curl commands to turn on/off/change color/light intensity of my govee light. Its a cheap light I got for less than $10 on amazon so haven't relied on it too much. Just use it as a status indicator of my house systems.

Re: Govee support

Posted: Friday 03 February 2023 8:51
by galadril
abductor wrote: Friday 03 February 2023 4:15 Interesting, I didn't know about option 2.
Yeah they added support for local UTP api lately i guess..

Re: Govee support

Posted: Friday 03 February 2023 16:14
by galadril
Looking at the data, it work be cool to combine the api and local udp api.

You can get the device name etc via the http api, and do the rest of the stuff locally via UDP discovery

curl --location --request GET 'https://developer-api.govee.com/v1/devices' \
--header 'Govee-API-Key: *****'

Would result in:

Code: Select all

{
    "data": {
        "devices": [
            {
                "device": "***",
                "model": "H6062",
                "deviceName": "Office Light 1",
                "controllable": true,
                "retrievable": true,
                "supportCmds": [
                    "turn",
                    "brightness",
                    "color",
                    "colorTem"
                ],
                "properties": {
                    "colorTem": {
                        "range": {
                            "min": 2000,
                            "max": 9000
                        }
                    }
                }
            }
        ]
    },
    "message": "Success",
    "code": 200
}
Here you can get the deviceNamd and match the device key (***) with the values you get from the UDP local api

Re: Govee support

Posted: Monday 06 February 2023 13:30
by galadril
Some more curl commands

1_ get state of device
curl --location --request GET 'https://developer-api.govee.com/v1/devi ... del=%model%' \
--header 'Govee-API-Key: %ApiKey%'

Code: Select all

{
    "data": {
        "device": "***",
        "model": "***",
        "properties": [
            {
                "online": true
            },
            {
                "powerState": "on"
            },
            {
                "brightness": 50
            },
            {
                "color": {
                    "r": 255,
                    "b": 0,
                    "g": 127
                }
            }
        ]
    },
    "message": "Success",
    "code": 200
}

2_ turning device on/off
curl --location --request PUT 'https://developer-api.govee.com/v1/devices/control' \
--header 'Govee-API-Key: %ApiKey%' \
--header 'Content-Type: application/json' \
--data-raw '{
"device": "%device_id%",
"model": "%model%",
"cmd": {
"name": "turn",
"value": "on"
}
}'

Code: Select all

{
    "code": 200,
    "message": "Success",
    "data": {}
}

2_ turning device brightness
curl --location --request PUT 'https://developer-api.govee.com/v1/devices/control' \
--header 'Govee-API-Key: %ApiKey%' \
--header 'Content-Type: application/json' \
--data-raw '{
"device": "%device_id%",
"model": "%model%",
"cmd": {
"name": "brightness",
"value": 50
}
}'

Code: Select all

{
    "code": 200,
    "message": "Success",
    "data": {}
}

Re: Govee support

Posted: Tuesday 07 February 2023 11:51
by breizhcat
Hello

Thanks for the information.
I put in place a virtual switch that I managed thanks to MQTT and Node-Red.

Image

And it works fine :)

Maybe I will dig a bit further the documentation to use RGB values etc.

Re: Govee support

Posted: Thursday 16 February 2023 19:38
by galadril
Thanks for that, maybe share your red-node export somewhere if possible?
But it would be cool if we could fix a nice python plugin for Domoticz with Govee

Re: Govee support

Posted: Thursday 16 February 2023 20:37
by waltervl
There also seems to be Govee MQTT gateways available so perhaps they are compatible with Domoticz MQTT Autodiscover (HA Protocol).

Re: Govee support

Posted: Friday 17 February 2023 8:32
by breizhcat
Hi @galadril

Here the export of my NodeRed : https://pastebin.com/VgPbxM7K

Re: Govee support

Posted: Friday 17 February 2023 19:47
by galadril
breizhcat wrote: Friday 17 February 2023 8:32 Hi @galadril

Here the export of my NodeRed : https://pastebin.com/VgPbxM7K
Tx!

Re: Govee support

Posted: Friday 17 February 2023 19:48
by galadril
waltervl wrote: Thursday 16 February 2023 20:37 There also seems to be Govee MQTT gateways available so perhaps they are compatible with Domoticz MQTT Autodiscover (HA Protocol).
That sounds interesting.. !

Re: Govee support

Posted: Thursday 11 May 2023 23:27
by galadril
Ive created a Domoticz python plugin.. it can currently set govee lights on / off and brightness and also color
https://github.com/galadril/Domoticz-Govee-Plugin

Re: Govee support

Posted: Friday 12 May 2023 9:43
by waltervl
Thanks, I added this to the wiki Plugin list https://www.domoticz.com/wiki/Plugins#P ... ugins_List

Re: Govee support

Posted: Friday 12 May 2023 9:53
by galadril
Ok tx, i was also adding it to the plugin manager / pp manager repo's

Re: Govee support

Posted: Tuesday 25 June 2024 21:29
by peatmoss
I've been using the govee plugin, thanks for writing it! I had a power failure and had to reset my govee permanent outdoor light controller, I had to re-add them to the app. Now the plugin seems to see them but they don't work, no errors in the debug logs. I've set the lights for local api access. Any idea what could be wrong?

Re: Govee support

Posted: Wednesday 26 June 2024 7:29
by peatmoss
I think I found the issue. My govee lights got a new IP and it stopped working after that. I had to delete the device from Domoticz and add it again to get it working. I still have random issues where the log says the device index does not exist when used in a script.

Re: Govee support

Posted: Friday 16 August 2024 20:44
by galadril
peatmoss wrote: Wednesday 26 June 2024 7:29 I think I found the issue. My govee lights got a new IP and it stopped working after that. I had to delete the device from Domoticz and add it again to get it working. I still have random issues where the log says the device index does not exist when used in a script.
mm interesting!. dont really know yet how to test this scenario

Re: Govee support

Posted: Saturday 14 September 2024 21:23
by Frtoto
Hello,
thanks for the plugin !

I've an error msg "2024-09-14 21:18:15.476 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly" every 14 seconds,but the light works properly.

If you have a solution, thanks a lot !

Domoticz version is 2024.7 build 16187
This is my debug info

Code: Select all

 2024-09-14 21:14:25.463 Govee Discover: Worker thread started.
2024-09-14 21:14:25.463 Status: Govee Discover: Started.
2024-09-14 21:14:25.463 Status: Govee Discover: Entering work loop.
2024-09-14 21:14:25.654 Status: Govee Discover: Initialized version 0.0.2, author 'Mark Heinis'
2024-09-14 21:14:25.656 Govee Discover: onStart called
2024-09-14 21:14:25.656 Govee Discover: Debug logging mask set to: PYTHON PLUGIN QUEUE IMAGE DEVICE CONNECTION MESSAGE
2024-09-14 21:14:25.656 Govee Discover: 'HardwareID':'31'
2024-09-14 21:14:25.657 Govee Discover: 'HomeFolder':'/home/pi/domoticz/plugins/Domoticz-Govee-Plugin/'
2024-09-14 21:14:25.657 Govee Discover: 'StartupFolder':'/home/pi/domoticz/'
2024-09-14 21:14:25.657 Govee Discover: 'UserDataFolder':'/home/pi/domoticz/'
2024-09-14 21:14:25.657 Govee Discover: 'Database':'/home/pi/domoticz/domoticz.db'
2024-09-14 21:14:25.657 Govee Discover: 'Language':'fr'
2024-09-14 21:14:25.657 Govee Discover: 'Version':'0.0.2'
2024-09-14 21:14:25.657 Govee Discover: 'Author':'Mark Heinis'
2024-09-14 21:14:25.657 Govee Discover: 'Name':'Govee Discover'
2024-09-14 21:14:25.657 Govee Discover: 'Port':'0'
2024-09-14 21:14:25.657 Govee Discover: 'Key':'GoveeDiscovery'
2024-09-14 21:14:25.657 Govee Discover: 'Mode1':'10000'
2024-09-14 21:14:25.657 Govee Discover: 'Mode6':'-1'
2024-09-14 21:14:25.657 Govee Discover: 'DomoticzVersion':'2024.7 (build 16187)'
2024-09-14 21:14:25.657 Govee Discover: 'DomoticzHash':'6b9cbb21c'
2024-09-14 21:14:25.657 Govee Discover: 'DomoticzBuildTime':'2024-08-22 08:08:34'
2024-09-14 21:14:25.657 Govee Discover: Device count: 1
2024-09-14 21:14:25.657 Govee Discover: Device: 1 - ID: 1725, Name: 'govee_SAM', nValue: 0, sValue: '100'
2024-09-14 21:14:25.657 Govee Discover: Device ID: '1725'
2024-09-14 21:14:25.657 Govee Discover: Device Name: 'govee_SAM'
2024-09-14 21:14:25.657 Govee Discover: Device nValue: 0
2024-09-14 21:14:25.657 Govee Discover: Device sValue: '100'
2024-09-14 21:14:25.657 Govee Discover: Device LastLevel: 100
2024-09-14 21:14:25.657 Govee Discover: Pushing 'PollIntervalDirective' on to queue
2024-09-14 21:14:25.657 Govee Discover: Acquiring GIL for 'onStartCallback'
2024-09-14 21:14:25.657 Govee Discover: Processing 'PollIntervalDirective' message
2024-09-14 21:14:25.657 Govee Discover: Acquiring GIL for 'PollIntervalDirective'
2024-09-14 21:14:25.657 Govee Discover: Heartbeat interval set to: 10000.
2024-09-14 21:14:25.657 Govee Discover: Acquiring GIL for 'PollIntervalDirective'
2024-09-14 21:15:27.290 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:15:41.293 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:15:55.296 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:16:09.300 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:16:23.303 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:16:37.309 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:16:51.313 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:17:05.328 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly
2024-09-14 21:17:19.357 Error: Govee Discover hardware (31) thread seems to have ended unexpectedly