pub struct GoveeClient { /* private fields */ }Expand description
Govee API client for the v2 router-based endpoints
Implementations§
Source§impl GoveeClient
impl GoveeClient
Sourcepub fn new(api_key: impl Into<String>) -> Self
pub fn new(api_key: impl Into<String>) -> Self
Create a new Govee API client with default configuration (10 second timeout, 3 retries).
Sourcepub fn with_config(api_key: impl Into<String>, config: ClientConfig) -> Self
pub fn with_config(api_key: impl Into<String>, config: ClientConfig) -> Self
Create a new Govee API client with a custom configuration.
Sourcepub async fn get_devices(&self) -> Result<Vec<Device>>
pub async fn get_devices(&self) -> Result<Vec<Device>>
List all devices and groups
Sourcepub async fn get_device_state(
&self,
device_id: &str,
sku: &str,
) -> Result<DeviceState>
pub async fn get_device_state( &self, device_id: &str, sku: &str, ) -> Result<DeviceState>
Get the current state of a device
Sourcepub async fn get_dynamic_scenes(
&self,
device_id: &str,
sku: &str,
) -> Result<Vec<Scene>>
pub async fn get_dynamic_scenes( &self, device_id: &str, sku: &str, ) -> Result<Vec<Scene>>
List the dynamic light scenes available for a device
(POST /router/api/v1/device/scenes).
Sourcepub async fn get_diy_scenes(
&self,
device_id: &str,
sku: &str,
) -> Result<Vec<Scene>>
pub async fn get_diy_scenes( &self, device_id: &str, sku: &str, ) -> Result<Vec<Scene>>
List the user-created DIY scenes available for a device
(POST /router/api/v1/device/diy-scenes).
Sourcepub async fn set_scene(
&self,
device_id: &str,
sku: &str,
scene: &Scene,
) -> Result<()>
pub async fn set_scene( &self, device_id: &str, sku: &str, scene: &Scene, ) -> Result<()>
Activate a scene previously returned by Self::get_dynamic_scenes
or Self::get_diy_scenes.
Sourcepub async fn set_brightness(
&self,
device_id: &str,
sku: &str,
brightness: u8,
) -> Result<()>
pub async fn set_brightness( &self, device_id: &str, sku: &str, brightness: u8, ) -> Result<()>
Set device brightness (0-100)
Sourcepub async fn set_color(
&self,
device_id: &str,
sku: &str,
color: Color,
) -> Result<()>
pub async fn set_color( &self, device_id: &str, sku: &str, color: Color, ) -> Result<()>
Set device color
Sourcepub async fn set_color_temperature(
&self,
device_id: &str,
sku: &str,
kelvin: i32,
) -> Result<()>
pub async fn set_color_temperature( &self, device_id: &str, sku: &str, kelvin: i32, ) -> Result<()>
Set color temperature in Kelvin (2000-9000)
Trait Implementations§
Source§impl Clone for GoveeClient
impl Clone for GoveeClient
Source§fn clone(&self) -> GoveeClient
fn clone(&self) -> GoveeClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GoveeClient
impl !UnwindSafe for GoveeClient
impl Freeze for GoveeClient
impl Send for GoveeClient
impl Sync for GoveeClient
impl Unpin for GoveeClient
impl UnsafeUnpin for GoveeClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more