Crates.io | smarthome-sdk-rs |
lib.rs | smarthome-sdk-rs |
version | 0.13.0 |
source | src |
created_at | 2022-08-23 09:20:09.916017 |
updated_at | 2024-10-22 17:40:14.550837 |
description | A Rust client-library which makes communication with the Smarthome server easy |
homepage | |
repository | https://github.com/smarthome-go/sdk-rs |
max_upload_size | |
id | 650881 |
size | 63,222 |
This is the new and improved version of the old SDK.
A Rust create which makes communication to a Smarthome server simple. It can be seen as a API wrapper for some commonly-used functions of the Smarthome server's API.
cargo add smarthome-sdk-rs
use smarthome_sdk_rs::{Auth, Client};
#[tokio::main]
async fn main() {
// Create a new Smarthome client
let client = Client::new(
"http://localhost:8082",
Auth::QueryToken("b67f2f5c7f2e6795d9f9b55678db7579".to_string()),
)
.await
.unwrap();
// Do something with the client
// This will turn on the finctional desk lamp
client.set_power("desk_lamp", true).await.unwrap();
}