JSPM

co2-monitor

3.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q48201F
  • License MIT License

Measure CO2, temperature and humidity in nodejs with the TFA-Dostmann AirControl Mini / Coach

Package Exports

  • co2-monitor
  • co2-monitor/co2-monitor.js

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 (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

co2-monitor

Reads CO2, temperature and humidity from TFA-Dostmann CO2-Monitor devices via USB.

Just connect the sensor via USB and run the example script. There is no need to set up the sensor or USB port.

Supported Hardware

TFA-Dostmann CO2-Monitor AIRCO2NTROL MINI 31.5006

TFA-Dostmann CO2-Monitor AIRCO2NTROL COACH 31.5009

Install

npm install co2-monitor

Example

const Co2Monitor = require('co2-monitor');

let co2Monitor = new Co2Monitor();

co2Monitor.on('connected', () => {
  console.log('Co2Monitor connected');
});

co2Monitor.on('disconnected', () => {
  console.log('Co2Monitor disconnected');
});

co2Monitor.on('error', (error) => {
  console.error(error);

  co2Monitor.disconnect(() => {
    process.exit(1);
  });
})

co2Monitor.on('co2', (co2) => {
  console.log('co2: ' + co2.toString());
})

co2Monitor.on('humidity', (humidity) => {
  console.log('humidity: ' + humidity.toString());
})

co2Monitor.on('temperature', (temperature) => {
  console.log('temperature: ' + temperature.toString());
})

co2Monitor.on('data', (data) => {
  console.log('data: ' + data.toString());
})

co2Monitor.connect((error) => {
  if (error) {
    console.error(error);
    process.exit(1);
  }

  co2Monitor.startTransfer((error) => {
    if (error) {
      console.error(error);
    }
  });
});

Events

Temperature

temperature event which is triggered on an update of temperature.

The event result is an object with the following structure:

{
  "value": 23.73,
  "type": "float",
  "unit": "degree celsius",
  "symbol": "°C"
}

Co2

co2 event which is triggered on an update of Co2.

The event result is an object with the following structure:

{
  "value": 1744,
  "type": "int",
  "unit": "parts per million",
  "symbol": "ppm"
}

Humidity

humidity event which is triggered on an update of relative humidity.

Only the AIRCO2NTROL COACH supports humidity data. The AIRCO2NTROL MINI will report humidity data with 0.

The event result is an object with the following structure:

{
  "value": 40.75,
  "type": "float",
  "unit": "relative humidity",
  "symbol": "% rh"
}

Data

data event which is triggered on updates of humidity, temperature or co2.

The event result is an object with the following structure:

{
  "co2": {
    "value": 1744,
    "type": "int",
    "unit": "parts per million",
    "symbol": "ppm"
  },
  "temperature": {
    "value": 23.73,
    "type": "float",
    "unit": "degree celsius",
    "symbol": "°C"
  },
  "humidity": {
    "value": 40.75,
    "type": "float",
    "unit": "relative humidity",
    "symbol": "% rh"
  }
}

Credits

based on code by henryk ploetz

License

MIT