#co2 #historical #measurement #sensor #data #bluetooth #aranet

aranet4

Read current and historical measurements from an Aranet4 CO2 Monitor over bluetooth

1 unstable release

0.1.0 Apr 26, 2024

#1496 in Hardware support

Custom license

25KB
575 lines

aranet4-rs

A rust library for the Aranet4 CO2 Sensor

Used by the aranet4-dashboard to display current and historical air quality data in a TUI

Usage

let sensor = sensor::SensorManager::init(None).await?;
let cur_readings = sensor.read_current_values().await?;
println!("Current Readings: {}", cur_readings);

let update_time = sensor.last_update_time().await?;
println!("Last Update Time: {} seconds", update_time.as_secs());


let cur_data = sensor.get_historical_data().await?;
println!("Current Data: {:?}", cur_data.as_records());
println!("Current Data Metadata: {:?}", cur_data.information);

Sample Output:

Current Readings: CO2: 475ppm, Temperature: 66.649994F, Pressure : 976kpa, Humidity : 36, Battery: 10, Status Color: 1
Last Update Time: 147 seconds
Current Data: [DataRecord { temperature: 69.08, humidity: 30, pressure: 987.9, co2: 373 }, ... ]
Current Data Metadata: HistoryInformation { interval: Duration { secs: 600, nanos: 0 }, beginning: 2024-04-25T18:08:04.162267335-05:00 }

Dependencies

~6–35MB
~527K SLoC