1
0
Fork 0
mirror of https://codeberg.org/icewind/mitemp-rs.git synced 2026-06-03 09:14:07 +02:00
Read Xiaomi MI Temperature and Humidity Sensor over BLE
  • Rust 92.7%
  • Nix 7.3%
Find a file
2020-02-08 01:18:06 +01:00
examples export bdaddr 2020-02-08 01:10:50 +01:00
src pub sensor data 2020-02-08 01:18:06 +01:00
.gitignore init repo 2020-01-18 19:37:33 +01:00
Cargo.toml fix git dependency 2020-02-08 01:05:12 +01:00
LICENSE-APACHE read and license 2020-02-08 01:00:22 +01:00
LICENSE-MIT read and license 2020-02-08 01:00:22 +01:00
README.md export bdaddr 2020-02-08 01:10:50 +01:00
test.py poc 2020-01-19 16:29:22 +01:00

mitemp.rs

Read Xiaomi MI Temperature and Humidity Sensor over BLE

Usafe

use mitemp::{adapter_by_mac, listen, BDAddr};
use std::str::FromStr;

fn main() -> Result<(), btleplug::Error> {
    let addr = BDAddr::from_str("00:1A:7D:DA:71:08").unwrap();
    let adapter = adapter_by_mac(addr)?;
    let device = BDAddr::from_str("58:2d:34:35:f3:d4").unwrap();

    let rx = listen(adapter, device);
    loop {
        let data = rx.recv().unwrap();
        dbg!(data);
    }
}

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be dual licensed as above, without any additional terms or conditions.