1 个不稳定版本
0.1.0 | 2024年4月26日 |
---|
#1381 in 硬件支持
25KB
575 行
aranet4-rs
用于 Aranet4 CO2 传感器的 Rust 库
由 aranet4-dashboard
使用来在 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);
示例输出
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 }
依赖项
~6–36MB
~530K SLoC