Crates.io | dirigera |
lib.rs | dirigera |
version | 0.2.0 |
source | src |
created_at | 2023-12-03 22:27:04.741744 |
updated_at | 2024-02-22 17:15:57.630658 |
description | Manage your IKEA Trådfri devices with Rust |
homepage | https://github.com/bombsimon/dirigera-rs |
repository | https://github.com/bombsimon/dirigera-rs |
max_upload_size | |
id | 1057112 |
size | 86,329 |
This crate is under development and can change at any time! Do not use just yet!
[!NOTE]
I only have a few IKEA devices so most of the endpoints I've been trying has been for lights. I also don't use scenes extensively but tried to set up and configure all available ones to research the API. If you have any other devices and want to contribute to the code that would be much appreciated!
To communicate with the Dirigera device you need to know its IP address and obtain a token. I can't help you find the IP but usually you can see this by looking at your routers device list.
Once you figured that out, run the generate-token
binary to generate a file
named config.toml
that will store the device's IP address and the obtained
token.
cargo run --bin generate-token --features binary <your-ip-address>
When you have a valid configuration file you can use the default trait for the
Hub
to generate an instance that will call the configured IP address with the
configured token.
let hub = dirigera::hub::Hub::default();
NOTE Since the configuration file depends on toml support for this is hidden behind a feature flag called
config
. To skip using toml simply use thenew
constructor and pass IP and token.
If you want to create the configuration file manually, this is what it looks like:
ip-address = 192.168.1.101
token = "abc123..."
See examples for examples on how to use this crate.
Just use the token you got and your favourite HTTP client.
› http --verify=no \
"https://[ip]:8443/v1/devices" \
"Authorization: Bearer $TOKEN"