3 unstable releases

0.4.0 Nov 17, 2024
0.3.1 Jun 7, 2022
0.3.0 Oct 31, 2021

#363 in Hardware support

Download history 10/week @ 2024-09-23 51/week @ 2024-11-11 69/week @ 2024-11-18 9/week @ 2024-12-09

129 downloads per month

MIT/Apache

17KB
130 lines

mitemp.rs

Read Xiaomi MI Temperature and Humidity Sensor over BLE

Usage

use btleplug::api::Manager as _;
use btleplug::platform::Manager;
use mitemp::listen;
use tokio::pin;
use tokio_stream::StreamExt;

#[tokio::main]
async fn main() -> Result<(), btleplug::Error> {
    let manager = Manager::new().await?;
    let adapter = manager.adapters().await?.pop().unwrap();

    let stream = listen(&adapter).await?;
    pin!(stream);

    while let Some(sensor) = stream.next().await {
        println!("{}: {:?}", sensor.mac, sensor.data);
    }
    Ok(())
}

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.

Dependencies

~6–34MB
~520K SLoC