goteleinfo
is a small library capable of decoding Teleinfo frames sent by an electrical meter.
Teleinfo is the protocol used by ERDF (Electricité Réseau Distribution France) electrical meters. Using this protocol, the electrical meter sends status frames periodically (~2 per second) that gives information about your electrical current consumption and status.
The Teleinfo protocol is described in this document
In order to convert read the frames, the Micro Teleinfo or PiTinfo is needed.
This library requires Go >= 1.16
The library provides counters to track frame reading and decoding errors. Those are stored internally as Prometheus metrics.
teleinfo_frames_read_total
: total number of raw Teleinfo frames read successfully.teleinfo_frames_read_errors_total
: total number of read errors. This metric is tagged byerror_type
.teleinfo_frames_decoded_total
: total number of decoded Teleinfo frames.teleinfo_frames_decode_errors_total
: total number of frame decoding errors. This is metric is tagged byerror_type
Bytes coming from the serial port are accumulated by the reader, looking for frame start and frame end markers to extract raw Teleinfo frames. This is called "reading".
Decoding refers to verifying checksum and extracting fields from frame (eg. OPTARIF
, HPHC
fields, etc...).
A simple HTTP server example is provided in cmd/teleinfo-json
that serves the last n frames, JSON encoded.
Frames are served in /frames
, while Prometheus metrics can be read from /metrics
URL.