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
Robin Appelman 16cf74d09f switch from channel api to iterator
this allows the api consumer to controll the threading
2020-12-12 15:06:00 +01:00
examples switch from channel api to iterator 2020-12-12 15:06:00 +01:00
src switch from channel api to iterator 2020-12-12 15:06:00 +01:00
.gitignore init repo 2020-01-18 19:37:33 +01:00
Cargo.toml update to new btleplug and adjust api to listen for all sensors 2020-12-12 13:57:00 +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 update to new btleplug and adjust api to listen for all sensors 2020-12-12 13:57:00 +01:00

mitemp.rs

Read Xiaomi MI Temperature and Humidity Sensor over BLE

Usage

use mitemp::{adapter_by_mac, listen, BDAddr};
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 rx = listen(adapter)?;
    loop {
        let data = rx.recv().unwrap();
        println!("{}: {:?}", data.mac, data.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.