gas2mqtt¶
Read your domestic gas meter with a magnetometer and publish to MQTT.
gas2mqtt attaches a QMC5883L magnetometer to a Raspberry Pi, detects gas meter rotations via a Schmitt trigger, and publishes counter ticks, temperature, and optional debug data to an MQTT broker — ready for Home Assistant or any MQTT consumer.
Features¶
- Gas tick detection — Schmitt trigger with configurable threshold and hysteresis
- Temperature monitoring — PT1-filtered, empirically calibrated
- Consumption tracking — optional cumulative m³ counter with MQTT set command
- Raw magnetometer output — optional debug device for calibration
- Health reporting — automatic heartbeats, per-device availability, and LWT
- Docker-ready — single
docker compose updeployment
Hardware¶
| Component | Details |
|---|---|
| Sensor | QMC5883L 3-axis digital magnetometer |
| Interface | I2C (default bus 1, address 0x0D) |
| Platform | Raspberry Pi (or any Linux SBC with I2C) |
Quick Links¶
-
Getting Started
Install gas2mqtt, connect the sensor, and see your first MQTT messages.
-
Configuration
All settings — environment variables,
.envfiles, and CLI flags. -
MQTT Topics
Topic reference with payload schemas, directions, and retain flags.
-
Architecture
Hexagonal architecture, domain logic, and cosalette framework integration.
-
API Reference
Auto-generated reference for settings, ports, domain logic, devices, and adapters.