Skip to content

Read telegrams from Sagemcom T210-D smart meters

Notifications You must be signed in to change notification settings

schopenhauer/sage

Repository files navigation

sage

Smart meter reader designed to read telegrams from Sagemcom smart meters. These are the new smart electricity and gas meters currently being installed in the Grand-Duchy of Luxembourg in order to comply with EU law by 2020.

According to Enovos, a smart meter incorporates advanced technologies that enable the precise measurement and recording of your energy consumption and production (if you have a photovoltaic installation for example). Thanks to this connection, your smart meter will enable your network operator to monitor the level of consumption and therefore to better control the flow of electricity in order to guarantee an operational network at all times.

Prerequisites

Usage

Backend

Please set the KEY environment variable with your P1 decryption key. Optionally, set the DATABASE_URL environment variable to store the received telegrams on your MongoDB instance.

Then, run the app:

node app.js

How to detect which serial ports are connected?

dmesg | grep tty

Use socat to make the serial port available as /dev/ttyVUSB0 on the local network on port 2001.

socat -d -d /dev/ttyUSB0,raw,echo=0 tcp-listen:2001,reuseaddr # local pc
socat -d -d PTY,raw,echo=0,link=/dev/ttyVUSB0 tcp:192.168.1.123:2001 # remote pc

Frontend

Simple, run the app:

node web.js

Data structure

Raw data

The smart meter sends data (647 bytes) with the below structure every 10 seconds.

  • Start byte: 0xDB (1 byte)
  • System title length: 0x08 (1 byte)
  • System title: "SAGgp" + 0x0067C8 (8 bytes)
  • Separator byte: 0x82 (1 byte)
  • Length of subsequent bytes: 0x027A (2 bytes)
  • Separator byte: 0x30 (1 byte)
  • Frame counter: 0x000069F1 (4 bytes)
  • Cipher text: ... (617 bytes)
  • GCM tag: 0x25D438E5B41F6EECA46ED60C (12 bytes)

The data is encrypted using AES-128-GCM (Galois Counter Mode) with the below parameters:

  • Encryption key = KEY environment variable
  • Initialisation vector (IV) = System title + Frame counter
  • Additional authentication data = AAD environment variable, or 3000112233445566778899AABBCCDDEEFF for Luxembourg meters
  • Authentication tag = GCM tag (see above)

Telegram structure

Please refer to the documentation of OBIS codes here.

Tested equipment

You need to connect your computer/Raspberry Pi to the Customer Port (Port P1) using the P1 smart meter cable. The technical specifications are available here, here and here.

Credits

The work was inspired by Michel Weimerskirch's smarty_dsmr_proxy, ndokter's dsmr_parser and Robert Klep's dsmr-parser.