This is a simple Go server for the Smart Message Language (SML) protocol, which is used by electricity meters in Germany.
An optical interface on the meter repeatedly transmits SML messages containing current meter readings.
The tool reads messages from a Serial interface, parses them using the 3e8.eu/go/sml library and publishes them as Prometheus metrics.
The Prometheus metric labels are autogenerated from whatever is received from the Smart Energy Meter. The tool is not sending anything to the serial port, it is just receiving cyclical messages (typical smart energy meters transfer one "unsolicited" status message telegram every second)
The only configuration required is the serial port -serial (default: "/dev/ttyUSB0") to use and the TCP port for the HTTP Webserver -listen-address (default ":8080"). Configuration is provided by command line arguments.
Installation
go install github.com/m29h/sml@latest
#run with
sml -serial /dev/ttyUSB0 -listen-address :8080
#access metrics with
curl http://localhost:8080/metrics