2 releases
0.1.1 | Jul 19, 2022 |
---|---|
0.1.0 | Jul 19, 2022 |
#20 in #co2
13KB
216 lines
Intro
An unofficial rust clone of the fantastic co2meter library avaiable here https://github.com/vfilimonov/co2meter
If you like this library, please give your appreciation to Vladimir Filimonov (https://github.com/vfilimonov) as I just translated his work to Rust.
Supported Features
[X] basic reading from the sensor
[ ] homekit
[ ] server
lib.rs
:
Rust wrapper for co2meter
This is a very basic rust implementation of the co2meter python package by Vladimir Filimonov (https://github.com/vfilimonov/co2meter)
It currently has support for basic monitor reading but lacks the advanced functionality of the other python version like homekit integration and a display server. There is no reason to add this.
Features
serde
: Enable serde Serialize and Deserialze derives for [CO2Reading] and [CO2MonitorInfo]
Getting Started
let mut co2 = CO2Monitor::default()?;
let result = co2.read_data(50)?;
dbg!(result);
Get info about your co2 monitor:
let co2 = CO2Monitor::default()?;
let info = co2.info();
dbg!(info);
Specify which co2 monitor you want to read from:
let interface_path = "...".to_owned();// Mine is "1-13:1.0"
let co2 = CO2Monitor::new(false, Some(interface_path))?;
let info = co2.info();
dbg!(info);
Dependencies
~2.9–8.5MB
~84K SLoC