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
2025-05-30 16:41:48 +02:00
.github/workflows fmt 2024-11-17 17:18:03 +01:00
examples updates 2024-11-17 17:13:54 +01:00
src updates 2024-11-17 17:13:54 +01:00
.envrc updates 2024-11-17 17:13:54 +01:00
.gitignore updates 2024-11-17 17:13:54 +01:00
Cargo.lock updates 2024-11-17 17:13:54 +01:00
Cargo.toml cargo meta 2024-11-17 17:17:39 +01:00
flake.lock flake update 2025-05-30 16:41:48 +02:00
flake.nix flake update 2025-05-30 16:41:48 +02: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 flake update 2025-05-30 16:41:48 +02:00

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.