Govee support

Python and python framework

Moderator: leecollings

Post Reply
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Govee support

Post 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
Last edited by galadril on Thursday 11 May 2023 23:28, edited 1 time in total.
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
abductor
Posts: 10
Joined: Tuesday 03 November 2015 18:32
Target OS: -
Domoticz version:
Contact:

Re: Govee support

Post 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.
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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..
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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": {}
}
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
breizhcat
Posts: 16
Joined: Tuesday 07 July 2020 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Govee support

Post 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.
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
waltervl
Posts: 5149
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Govee support

Post by waltervl »

There also seems to be Govee MQTT gateways available so perhaps they are compatible with Domoticz MQTT Autodiscover (HA Protocol).
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
breizhcat
Posts: 16
Joined: Tuesday 07 July 2020 17:51
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: France
Contact:

Re: Govee support

Post by breizhcat »

Hi @galadril

Here the export of my NodeRed : https://pastebin.com/VgPbxM7K
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post by galadril »

breizhcat wrote: Friday 17 February 2023 8:32 Hi @galadril

Here the export of my NodeRed : https://pastebin.com/VgPbxM7K
Tx!
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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.. !
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
User avatar
waltervl
Posts: 5149
Joined: Monday 28 January 2019 18:48
Target OS: Linux
Domoticz version: 2024.7
Location: NL
Contact:

Re: Govee support

Post by waltervl »

Thanks, I added this to the wiki Plugin list https://www.domoticz.com/wiki/Plugins#P ... ugins_List
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post by galadril »

Ok tx, i was also adding it to the plugin manager / pp manager repo's
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
peatmoss
Posts: 7
Joined: Wednesday 11 December 2019 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Govee support

Post 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?
peatmoss
Posts: 7
Joined: Wednesday 11 December 2019 23:06
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Govee support

Post 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.
User avatar
galadril
Posts: 824
Joined: Monday 07 September 2015 10:32
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Contact:

Re: Govee support

Post 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
Solar panels of Ginlong, Omnik-Solar, Transenergy or Solarman?? Try my Android app:
https://play.google.com/store/apps/deta ... ongmonitor
Frtoto
Posts: 4
Joined: Monday 06 August 2018 20:17
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.7
Contact:

Re: Govee support

Post 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 
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest