#co2 #devices #reading #aranet4 #btle #aranet

aranet-btle

A simple library to get readings from an Aranet4 co2 device

3 releases

0.1.2 Nov 6, 2023
0.1.1 Nov 3, 2023
0.1.0 Nov 2, 2023

#682 in Hardware support

MIT license

11KB
169 lines

Aranet btle

A simple library to get readings from an Aranet4 co2 device

use aranet_btle;

use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    let device = aranet_btle::connect().await?;

    let data = device.read_data().await?;

    println!("co2: {}ppm", data.co2);
    println!("temperature: {}C", data.temperature);
    println!("pressure: {}hPa", data.pressure);
    println!("humidity: {}%", data.humidity);
    println!("battery: {}%", data.battery);
    println!("status: {}", data.status);
    println!("interval: {}", data.interval);
    println!("age: {}s", data.age);

    Ok(())
}

Roadmap:

  • Connect to one device
  • Get readings
  • Get readings from BTLE advertisements (scan)
  • Allow connecting to multiple devices
  • Connect to a specific device
  • Fetch sensor history data
  • Better management of the btle code so we can play nice with other libraries.
  • Allow selecting bluetooth adapter

Dependencies

~5–34MB
~516K SLoC