Kuba Wolanin

Adding CO2 sensor to openHAB

By Kuba Wolanin
Published in Home automation
May 19, 2021
1 min read
Adding CO2 sensor to openHAB

There are studies that suggest there’s a correlation between a level of CO2 in the air and general feeling of tiredness. In my home there’s a full house ventillation system, that’s also hooked up to openHAB. But until recently it was working on a plain time schedule - the system was setting fan speed to higher values in the daytime, and lowered it after sunset.

Adding a CO2 sensor would allow me to set ventillation more accurately + maybe notify me to open windows in certain room.

MH-Z19B Sensor

I bought a MH-Z19B sensor and wired it up with a Wemos D1 Mini -

Wemos D1 Mini

A small ESP8266-based board that has WiFi and is very well known in the makers community.

I flashed Tasmota to it (using Tasmotizer) and chose tasmota-sensors version, as it contains a template for MH-Z19B.




Added a single Number item that will receive MQTT messages from the sensor.

2021 05 19 09 30 52
openHAB sitemap fragment showing CO2 level in my living room


Having a openHAB persistence service in place (in my case it’s InfluxDB), it’s very convenient to visualize the data in Grafana chart:

2021 05 19 09 16 53
Grafana chart with my CO2 sensor values

Previous Article
Getting power outages notifications


Home automation
Misc Projects

Related Posts

Node-Red: One button, multiple switches/lights
January 09, 2022
1 min
© 2022, All Rights Reserved.

Quick Links


Social Media