Expand description
This is a Rust library to interact with the SwitchBot API and control your SwitchBot devices programmatically.
For a command line tool,
please see the switchbot-cli
crate.
§Examples
let mut switch_bot = SwitchBot::new_with_authentication(token, secret);
switch_bot.load_devices().await?;
let device = &switch_bot.devices()[0];
let command = CommandRequest {
command: "turnOn".into(),
..Default::default()
};
device.command(&command).await?;
Structs§
- Command
Request - A command request to send to the SwitchBot API.
- Device
- Represents a device.
- Device
List - A list of
Device
s. - Switch
Bot - Represents a SwitchBot API server.
- Switch
BotError - Error from the SwitchBot API.