How mruettgers/smlreader works
SMLReader is an ESP8266 smart-meter-to-MQTT gateway. Its principal workflow reads SML bytes from configured optical sensor inputs, detects and parses complete messages, then publishes meter values as MQTT topics. The firmware also provides Wi-Fi and MQTT configuration through a web interface, an HTTP update endpoint, and optional serial diagnostics. The graph follows the sampled runtime code and README; external library internals and unsampled configuration behavior are not expanded.
Main entry points: main.cpp Firmware loop · Sensor.h Sensor reader · MqttPublisher.h MQTT publisher · debug.h Serial diagnostics
Components 13
Meter ingestion
- Sensor settings
src/config.h - Sensor reader
src/Sensor.h - Message handler
src/main.cpp - SML parser
- Firmware loop
src/main.cpp
Device connectivity
- Setup interface
- Wi-Fi network
- HTTP updater
- MQTT publisher
src/MqttPublisher.h
Runtime support
- Serial diagnostics
src/debug.h - DLMS units
src/unit.h
Other components
- Optical meter
- MQTT broker
Connections 14
- Optical meter → Sensor reader: sends bytes
README.md - Firmware loop → Sensor settings: reads settings
src/main.cpp - Firmware loop → Sensor reader: creates and loops
src/main.cpp - Sensor reader → Message handler: calls callback
src/Sensor.h - Message handler → SML parser: parses message
src/main.cpp - Message handler → MQTT publisher: publishes file
src/main.cpp - Firmware loop → Setup interface: configures routes
src/main.cpp - Firmware loop → Wi-Fi network: initializes Wi-Fi
src/main.cpp - Firmware loop → HTTP updater: sets up updates
src/main.cpp - Firmware loop → MQTT publisher: connects on Wi-Fi
src/main.cpp - MQTT publisher → MQTT broker: publishes MQTT
src/MqttPublisher.h - Firmware loop → Serial diagnostics: logs runtime
src/main.cpp - Sensor reader → Serial diagnostics: logs sensor state
src/Sensor.h - Serial diagnostics → DLMS units: formats unit labels
src/debug.h