3 releases
0.1.5 | Feb 18, 2022 |
---|---|
0.1.4 | Jan 28, 2022 |
#228 in #protocol
9KB
138 lines
miio-proto
Crate implements MIIO protocol which is used to control Xiaomi devices over WiFi/UDP.
Some useful links:
https://github.com/marcelrv/XiaomiRobotVacuumProtocol/blob/master/Protocol.md
- Packet formathttps://github.com/marcelrv/XiaomiRobotVacuumProtocol
- Xiaomi Vacuum cleaner JSON commands
lib.rs
:
Simple example
let rt = tokio::runtime::Runtime::new().expect("Async runtime");
rt.block_on(async {
let conn = Device::new(
"192.168.1.1:54321",
1234512345,
[
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xaa, 0xbb, 0xcc, 0xdd,
0xee, 0xff,
],
)
.await
.expect("Connect");
conn.send_handshake().await.expect("Handshake");
let (hello, _) = conn.recv().await.expect("Response");
conn.send(
hello.stamp + 1,
"{'method':'power','id':1,'params':['off']}",
)
.await
.expect("Request");
})
Dependencies
~5–11MB
~136K SLoC