aranet4

Crates.ioaranet4
lib.rsaranet4
version0.1.0
sourcesrc
created_at2024-04-26 18:48:33.304266
updated_at2024-04-26 18:48:33.304266
descriptionRead current and historical measurements from an Aranet4 CO2 Monitor over bluetooth
homepage
repositoryhttps://github.com/lpraneis/aranet4-rs
max_upload_size
id1221668
size25,675
Logan Praneis (lpraneis)

documentation

README

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 }
Commit count: 22

cargo fmt