Crates.io | aranet4 |
lib.rs | aranet4 |
version | 0.1.0 |
source | src |
created_at | 2024-04-26 18:48:33.304266 |
updated_at | 2024-04-26 18:48:33.304266 |
description | Read current and historical measurements from an Aranet4 CO2 Monitor over bluetooth |
homepage | |
repository | https://github.com/lpraneis/aranet4-rs |
max_upload_size | |
id | 1221668 |
size | 25,675 |
A rust library for the Aranet4 CO2 Sensor
Used by the aranet4-dashboard
to display current and historical air quality data in a TUI
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 }