Crate switchbot_api

Source
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§

CommandRequest
A command request to send to the SwitchBot API.
Device
Represents a device.
DeviceList
A list of Devices.
SwitchBot
Represents a SwitchBot API server.
SwitchBotError
Error from the SwitchBot API.