Andre-Schuiki / esphome_im350

GNU General Public License v3.0
13 stars 8 forks source link

esphome_im350

Custom Component for ESP Home to support the IM350 (Smart Meter from a local provider in Austria/Carinthia.)

From the provider i didn't get detailed instructions how i get the information from the customer interface or how i decrypt it, so i researched a lot and here are all information's i found for the device, i hope this will help other people who try to get the data from their smart meters.

The easiest solution to translate and decrypt the data is to use a device which supports python (raspberry for example) and then use the python library: https://github.com/Gurux/Gurux.DLMS.Python

But i wanted a solution which could run on an ESP and a ESPHome Integration.

ESPHome Installation

see esp_home folder.

Python Examples

Two example files in python to translate the message from the meter.

Standalone Version for testing

see standalone_version folder for more information.

Provider Documentation for the Customer Interface of the Smart Meter

Other Projects, Useful Links

This sources have helped a lot to get this working.

Requirements

Data Output of the Customer Interface

Circuit Diagramm

For this Smart Meter you need a external Power source, other devices/models don't need that - if you have another device please ask your power network provider for a pinout diagram or documentation.

Customer Interface Pinout

Pinout Notes

For powering up the device 3.3v from the ESP is enough! Pin 1/6 is for the internal power supply. Pin 2 is the data request pin this one also needs 3.3v/5v. Pin 5 sends out the data - you need a pull up resistor (i'm using a 10k resistor) here and a transistor for inverting the signal.

Pinout Diagrams from the providers

Pinout Pinout

Basically i used this diagram (but with another esp32 board az-delivery ESP32 D1 Mini NodeMCU)

Source: (https://github.com/saghonfly/shrdzm/raw/dev/hardware/IM350_2.png)

Example Message

Workflow

  1. Set Pin2 of Customer Interface to High
  2. Read Data from Serial Port
  3. Set Pin2 to low
  4. Check if message is starting and ending with 7E
  5. Decrypt the cipher text
  6. Validate decrypted cipher text with current date cause validate with tag is not working..
  7. Parse decrypted cipher text
  8. Publish data to ESPHome

Decrypting the message

Messages are encrypted with AES128-GCM.

Each meter has its own 16 byte encryption key. Ask your provider for the key.

For decryption you need: