Package Exports
- node-co2-monitor
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-co2-monitor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-co2-monitor
Node.JS library for reading CO2 concentration and indoor temperature from TFA Dostmann AirCO2NTROL Mini.
Contents
Supported Hardware
Install
npm install node-co2-monitorGetting started
'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);
});
});API
Methods
new CO2Monitor(options) -> Object
Create CO2Monitor instance.
monitor.connect(Function callback)
Setup usb connection to CO2 monitor.
monitor.disconnect(Function callback)
Close device connection.
monitor.transfer([Function callback])
Start data transfer from CO2 monitor.
monitor.temperature -> Number
Get latest Ambient Temperature (Tamb) in ℃.
monitor.co2 -> Number
Get latest Relative Concentration of CO2 (CntR) in ppm.
Events
temp -> Number
Triggered by temperature update with Ambient Temperature (Tamb) in ℃.
co2 -> Number
Triggered by co2 update with Relative Concentration of CO2 (CntR) in ppm.
error -> Error
Triggered by error.
Projects using node-co2-monitor
- CO2 Monitor Exporter - Prometheus exporter for CO2 concentration and indoor temperature from TFA Dostmann AirCO2NTROL Mini.
Credits
Inspired by Henryk Plötz: Reverse-Engineering a low-cost USB CO₂ monitor.
License
MIT