aiogovee icon indicating copy to clipboard operation
aiogovee copied to clipboard

aiogovee

Python 3 /asyncio library for communication with Govee devices using their local API.

PyPI version PyPI version license

This is my first time coding in Python, this library was written using François Wautier's aiolifx as sample / guide and adapted to communicate with the much simpler Govee Local API

Installation

This library is published on PyPi so:

 pip3 install aiogovee

or

 python3 -m pip install aiogovee

How to control your Govee Devices

First, you need enable local API for each supported device:

 - Open the Govee App
 - Click on the Device
 - Click on the Gear signs at the top right corner
 - Turn On "Lan Control"

Enabling Lan Control

NOTE: If your don't see the "Lan Control" switch, most likely your device is not supported, you can check the Govee Local API documentation linked above to for the list of supported devices, they update this document as they add support for more devices. If your device is listed there then either your device does not have the latest firmware or its hardware version is too old and does not support this feature (I've sees reports of this from some users), at this point your best bet it to contact Govee Support about it, they are very responsive and helpful.

Once you have enabled "Lan Control" for your devices, you can test the library by using the example utility to fully manage your those Devices:

 python3 -m aiogovee

While the application is running, it will run discovery over each network interface available (including VLAN interfaces) every 5s (Library default is 180s but I configured it lower for this demo utility). Devices do not always respond to the discovery broadcast but they usually all show up after a couple of discovery attempts, just let the application run for a bit longer and hit enter to refresh the list of discovered devices.

At the moment the API is very limited, these are the only supported operations:

 - Get Status
 - Turn On/Off
 - Change Brightness (0-100)
 - Change Color (R) (G) (B)
 - Change ColorTemperature in Kelvin (0-9000)

How to use the Library

Essentially, you create an object with at least 2 methods:

- register
- unregister

You then start the GoveeListener task in asyncio, passing the object created above, the IP of the desired network interface to run discovery on (you can start multiple GoveeListeners if you have multiple network interfaces to subnets with Govee devices) and the discovery interval in seconds (180s by default). It will register any new Device it finds.

Once a device is registered, there are attribute methods for any of the supported actions in the API.

The easiest way is to look at the main.py which is the demo utility included as an example of how to use the library.

Notes

  1. GoveeListener uses UDP broadcast for discovery

  2. I only have 2 of the supported devices so I could not test with any other but the API is really simple and they all should work the same, these are the devices I have tested with:

    • H6061 - Glide Hexa Light Panels
    • H6172 - RGBIC Outdoor LED Strip Lights
  3. This is my first time coding in Python and my first project published in GitHub and PyPI, if you notice I did anything wrong, please point it out to me, it has been a great learning experience.

Thanks

Thanks to François Wautier, his aiolifx library which provided to be an excellent resource and base for this project.