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§

CommandHelp
Human-readable description of a CommandRequest.
CommandRequest
A command request to send to the SwitchBot API.
Device
A device in the SwitchBot API.
DeviceList
A list of Devices.
Help
Load and parse the documentations at the SwitchBot API.
Markdown
Represents a simple Markdown.
SwitchBot
Represents a SwitchBot API server.
SwitchBotError
Error from the SwitchBot API.