Expand description

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);

Structs

The main class to interact with. Instantiating this class can fail as it creates a device connection when it is created.

A simple struct to display information about the device

A simple struct for return values.