switchbot-api2 0.2.2

SwitchBot device control
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use anyhow::Result;
use switchbot_api2::SwitchBot;

#[tokio::main]
async fn main() -> Result<()> {
    let switchbot = SwitchBot::new_from_env()?;

    for dev in switchbot.get_devices().await? {
        let status = switchbot.get_battery(&dev).await?;
        println!("{}: {:?}", dev.name, status);
    }

    Ok(())
}