Skip to content

Go library to decode Teleinfo frames sent by an electrical meter

License

Notifications You must be signed in to change notification settings

j-vizcaino/goteleinfo

Repository files navigation

goteleinfo: monitor your house electrical current

Build badge Go Reference GoReport badge

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.

Requirements

This library requires Go >= 1.16

Metrics

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 by error_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 by error_type

Difference between reading and decoding

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...).

Example: serving Teleinfo as JSON frames

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.

About

Go library to decode Teleinfo frames sent by an electrical meter

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages