Control Govee LED lights
Project description
Control Govee LED Lights from Python
This library provides control over Govee-manufactured lights. @wez built this for use with Home Assistant.
It has an emphasis on making use of their LAN API but also makes use of their HTTP API in order to retrieve the user-assigned names of the devices, and to control the devices that don't yet support the LAN API.
Getting Started
from govee_led_wez import GoveeController, GoveeDevice
controller = GoveeController()
def device_changed(device: GoveeDevice):
print(f"{device.device_id} state -> {device.state}")
controller.set_device_change_callback(device_changed)
if YOUR_API_KEY:
controller.set_http_api_key(YOUR_API_KEY)
controller.start_http_poller()
controller.start_lan_poller()
# Devices will now be discovered asynchronously
Notes
Devices are discovered asynchronously. While the full set of devices
associated with your account can be returned via the HTTP API, the
initial request for them is made asynchronously by the background
http poller task. If you need the list immediately, you can call
controller.query_http_devices()
to obtain that list.
The HTTP API has some tight rate limits. This library prefers to avoid
read-after-write operations to verify the state in order to reserve the calls
for issuing commands to your devices. This means that, for devices that don't
support the LAN API, the assumed state may be a bit wonky until the device
is controlled. You can call controller.update_device_state()
to
explicitly retrieve the state.
Contributing
A Makefile
provides shortcuts for doing stuff:
make setup
- do one-time setup for developingmake check
- performs type checking and lintingmake test
- runs testsmake fmt
- runs code formatting, potentially appeasingmake check
make build
- builds distributable bits
GitHub Actions will run the check
, test
and build
actions on PRs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for govee_led_wez-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8a2a06196fa657138630b37fe173707500a896bbd117ee1cc10950d4a032267c |
|
MD5 | f18ec8af896db6521587c0ab9c75d055 |
|
BLAKE2b-256 | ae0223d77ce161c15c8f921aec3490122c8218164ff82063848a675e05ecc9cb |