Node.JS library for reading CO2 concentration and indoor temperature from TFA Dostmann AirCO2NTROL Mini.
npm install node-co2-monitor
'use strict';
const CO2Monitor = require('node-co2-monitor');
const monitor = new CO2Monitor();
// Connect device.
monitor.connect((err) => {
if (err) {
return console.error(err.stack);
}
console.log('Monitor connected.');
// Read data from CO2 monitor.
monitor.transfer();
});
// Get results.
monitor.on('temp', (temperature) => {
console.log(`temp: ${ temperature }`);
});
monitor.on('co2', (co2) => {
console.log(`co2: ${ co2 }`);
});
// Error handler
monitor.on('error', (err) => {
console.error(err.stack);
// Disconnect device
monitor.disconnect(() => {
console.log('Monitor disconnected.');
process.exit(0);
});
});
Create CO2Monitor instance.
Setup usb connection to CO2 monitor.
Close device connection.
Start data transfer from CO2 monitor.
Get latest Ambient Temperature (Tamb) in ℃.
Get latest Relative Concentration of CO2 (CntR) in ppm.
Triggered by temperature update with Ambient Temperature (Tamb) in ℃.
Triggered by co2 update with Relative Concentration of CO2 (CntR) in ppm.
Triggered by error.
- CO2 Monitor Exporter - Prometheus exporter for CO2 concentration and indoor temperature from TFA Dostmann AirCO2NTROL Mini.
Inspired by Henryk Plötz: Reverse-Engineering a low-cost USB CO₂ monitor.
MIT