• Stars
    star
    345
  • Rank 122,412 (Top 3 %)
  • Language
    Go
  • License
    MIT License
  • Created over 6 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

COâ‚‚ & Temperature monitor

Go Report Card GoDoc

COâ‚‚ monitor

Setup & Example

Setup

Dashboard

Motivation

Some time ago an article about a low cost COâ‚‚ monitor came to our attention. A colleague quickly adopted the python code to fit in our prometheus setup. Since humans are sensitive to temperature and COâ‚‚ level, we were now able to optimize HVAC settings in our office (Well, we mainly complained to our facility management).

For numerous reasons I wanted to replace the python code with a static Go binary.

Hardware

  • COâ‚‚ meter: Can be found for around 70EUR/USD at amazon.com & amazon.de. Regardless of minor differences between both devices, both work.
  • Some machine which can run the compiled Go binary, has USB and is reachable from your prometheus collector. A very first version of a raspberry pi is already sufficient.

Software

You need prometheus to collect the metrics.

It might make things easier when you set up an udev rule e.g.

$ cat /etc/udev/rules.d/99-hidraw-permissions.rules 
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"

Run & Collect

Help

$ ./co2monitor --help      
usage: co2monitor [<flags>] <device> [<listen-address>]

Flags:
  --help  Show context-sensitive help (also try --help-long and --help-man).

Args:
  <device>            CO2 Meter device, such as /dev/hidraw2
  [<listen-address>]  The address to listen on for HTTP requests.

Starting the meter export

$ ./co2monitor /dev/hidraw2
2018/01/18 13:09:31 Serving metrics at ':8080/metrics'
2018/01/18 13:09:31 Device '/dev/hidraw2' opened

Credit

Henryk Plötz & wooga