govee-api2
A Rust client for Govee's v2 router-based platform API
(https://openapi.api.govee.com).
Features
- Async/await with tokio
- Device and group discovery
- Device state queries
- Power, brightness, RGB color, and color temperature control
- Dynamic light scenes and DIY scenes (list + activate)
- Per-segment color and brightness for segmented lights
- Configurable timeout and retries with exponential backoff
- Typed errors, including rate-limit detection with
Retry-Afterparsing - TLS via rustls (no OpenSSL dependency)
Installation
This crate is not published on crates.io. Use it as a path or git dependency:
[]
= { = "govee-api2" }
# or
= { = "https://github.com/jhheider/govee-tui" }
Usage
use ;
async
Configuration
GoveeClient::new uses a 10 second timeout and 3 retries. Transport errors
and HTTP 5xx responses are retried with exponential backoff; 429 rate-limit
responses are never retried and surface immediately as
Error::RateLimited.
use Duration;
use ;
let client = with_config;
Scenes
# use GoveeClient;
# async
Segmented lights
For devices with devices.capabilities.segment_color_setting (light strips,
some lamps), individual segments can be colored and dimmed:
# use GoveeClient;
# async
API Coverage
This crate implements the following Govee platform API endpoints:
GET /router/api/v1/user/devices- List devices and groupsPOST /router/api/v1/device/state- Get device statePOST /router/api/v1/device/control- Control devicePOST /router/api/v1/device/scenes- List dynamic light scenesPOST /router/api/v1/device/diy-scenes- List DIY scenes
Supported Capabilities
devices.capabilities.on_off- Power controldevices.capabilities.range- Brightness controldevices.capabilities.color_setting- RGB color and color temperaturedevices.capabilities.dynamic_scene- Dynamic light scenesdevices.capabilities.diy_color_setting- DIY scenesdevices.capabilities.segment_color_setting- Per-segment color/brightness
Other capability types (work modes, toggles, music mode, sensors, ...) are
exposed as raw Capability values on Device but do not have dedicated
helper methods.
Device Groups
The API supports device groups (multiple devices controlled together). Groups have:
sku == "SameModeGroup"- No
device_typefield - Same control capabilities as individual devices
# use GoveeClient;
# async
Error Handling
All methods return Result<T, govee_api2::Error>:
# use GoveeClient;
# async
Rate Limits
Govee's platform API allows 10,000 requests per account per day and answers
HTTP 429 when exceeded. This client never blind-retries 429 responses; it
returns Error::RateLimited with a retry hint parsed from the
Retry-After header (or X-RateLimit-Reset/API-RateLimit-Reset, if
present).
Getting an API Key
- Download the Govee Home app
- Go to Settings → Apply for API Key
- Follow the email instructions
- Your API key will be sent via email
License
MIT OR Apache-2.0