gitwtfhub

wtf is co2-sensor-zigbee-rust?

manfredfr/co2-sensor-zigbee-rust — explained in plain English

Analysis updated 2026-05-18

1RustAudience · developerComplexity · 4/5Setup · hard

TL;DR

A do it yourself CO2 sensor that runs on a small chip and reports air quality to Home Assistant over Zigbee, using an onboard LED to show if the air is good or bad.

Mindmap

mindmap
  root((CO2 Sensor))
    What it does
      Measures CO2 indoors
      Reports over Zigbee
      LED air quality light
    Tech stack
      Rust
      ESP-IDF
      Zigbee2MQTT
    Use cases
      Home air monitoring
      Smart home integration
      Learn Zigbee firmware
    Audience
      Developers
      Home Assistant users
    Setup
      Wire sensor to chip
      Flash Rust firmware
      Add Z2M converter

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Build a battery free, WiFi free CO2 sensor for a room and monitor it in Home Assistant.

REASON 2

Get an instant color coded warning when indoor air quality gets poor or dangerous.

REASON 3

Learn how to write Zigbee device firmware in Rust on an ESP32 chip.

REASON 4

Add a custom Zigbee device to a Zigbee2MQTT and Home Assistant smart home setup.

What's in the stack?

RustESP-IDFZigbeeZigbee2MQTTHome Assistant

How it stacks up

manfredfr/co2-sensor-zigbee-rustabc3dz/mixxxabyo-software/ferro-stash
Stars111
LanguageRustRustRust
Setup difficultyhardmoderatemoderate
Complexity4/52/54/5
Audiencedevelopergeneralops devops

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · hard Time to first run · 1h+

Needs specific hardware (ESP32-H2, Senseair S8, Zigbee coordinator) plus a Rust embedded toolchain.

Wtf does this do

This project is the firmware for a small home built air quality sensor that measures carbon dioxide levels indoors and reports them wirelessly. It runs on an ESP32-H2 microcontroller connected to a Senseair S8 sensor, and it does not need WiFi or batteries. Instead it talks to your smart home setup over Zigbee, joining a Zigbee network the same way a commercial sensor would, and reporting into Home Assistant through Zigbee2MQTT. The device checks CO2 levels every 10 to 300 seconds, and you can change how often it checks directly from Home Assistant. An onboard multicolor LED gives you an instant sense of air quality without opening an app: green means the air is fine, orange means it is getting stale, red means it is bad, and a flashing red means the CO2 level is dangerously high. The brightness of that LED can also be adjusted from Home Assistant, and your settings for both the reporting interval and the LED brightness are remembered by the device itself. Under the hood, the sensor exposes its readings using standard Zigbee building blocks, a bit of a workaround since a true CO2 measurement type is not supported the normal way, so the project reuses a temperature reading slot to carry the CO2 number instead. A companion file tells Zigbee2MQTT how to translate that into a proper CO2 reading, a report interval setting, and an LED brightness setting. The firmware itself is written in Rust, targeting the ESP32-H2 chip through Espressif's development tools, and it replaces an earlier version that was written in Arduino's C or C plus plus style code. Wiring the sensor to the microcontroller only requires four wires, and no extra components are needed to convert voltage levels between the two parts. The project includes wiring diagrams, hardware part numbers, and step by step instructions for adding it to Zigbee2MQTT, including how to give the device a custom icon.

Yoink these prompts

Prompt 1
Explain how Zigbee end devices work and why this sensor does not need WiFi.
Prompt 2
Walk me through wiring the Senseair S8 sensor to the ESP32-H2 using the pin table in this README.
Prompt 3
Help me set up the Rust toolchain needed to build firmware for the ESP32-H2 chip.
Prompt 4
Explain how the Co2-Sensor.js file lets Zigbee2MQTT understand this device's readings.
Prompt 5
Show me how to add a custom device icon for this sensor in Zigbee2MQTT.

Frequently asked questions

wtf is co2-sensor-zigbee-rust?

A do it yourself CO2 sensor that runs on a small chip and reports air quality to Home Assistant over Zigbee, using an onboard LED to show if the air is good or bad.

What language is co2-sensor-zigbee-rust written in?

Mainly Rust. The stack also includes Rust, ESP-IDF, Zigbee.

How hard is co2-sensor-zigbee-rust to set up?

Setup difficulty is rated hard, with roughly 1h+ to a first successful run.

Who is co2-sensor-zigbee-rust for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.