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 13:33:02 +01:00
examples api refactoring 2020-02-08 13:33:02 +01:00
src api refactoring 2020-02-08 13:33:02 +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 api refactoring 2020-02-08 13:33:02 +01:00
test.py poc 2020-01-19 16:29:22 +01:00

mitemp.rs

Read Xiaomi MI Temperature and Humidity Sensor over BLE

Usage

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

fn main() -> Result<(), btleplug::Error> {
    env_logger::init();

    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 sensor = Sensor::new(adapter, device);

    let rx = sensor.listen();
    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.