Git Product home page Git Product logo

dsmr's Introduction

Buy Me A Coffeeย button_buy-slimmelezer

Please read!!

Since ESPHome version 2021.8.0 the DSMR component is natively in ESPHome. Please use this in your code, as all maintenance and changes are published there and not in my code

All documentation is on ESPHome self: https://esphome.io/components/sensor/dsmr.html

A big shout out to @glmnet @klaasnicolaas @frenck and off course @home-assistant & @esphome for improving the code and place it within ESPHome natively!

DSMR component for ESPHome

The SlimmeLezer is a compact build easy to use module to read data via the P1 port on a Smart Meter. Based on an ESP8266 (Wemos D1), the SlimmeLezer is perfect to use with ESPHome and integrates seamless into Home Assistant.

IMG_2886 IMG_2887

DSMR component

The main goal is to create one universal component, which can be used in every country. Though the DSMR (Dutch Smart Meter Requirements) is specified with pre specified OBIS code, not every country has exact the same code. Some examples:

Version information for P1 output

  • Default OBIS: 1-3:0.2.8.255
  • Belgium OBIS: 0-0:96.1.4.255

Meter Reading electricity delivered to client (Tariff 1) in 0,001 kWh

  • Default OBIS: 1-0:1.8.1.255
  • Luxembourg OBIS: 1-0:1.8.0.255

Meter Reading electricity delivered by dient (Tariff 1) in 0,001 kWh

  • Default OBIS: 1-0:2.8.1.255
  • Luxembourg OBIS: 1-0:2.8.0.255

Some countries like Luxembourg, Sweden and Hungary, uses kvar next to kW. Therefor all deviant OBIS code is added as extra fields. This gives more sensors than needed, yet it can be used in every country where DSMR based Smart Meters is being used.

Decryption data for Luxembourg

Smart Meters used in Luxembourg are using encryption. Decryption for Luxembourg is build in the code. This can be defined in the code:

dsmr:
  id: dsmr_instance
  decryption_key: '00112233445566778899AABBCCDDEEFF'

When the key is not set in the code, or when the key changes, it can be set/changes via a Service within Home Assistant, created via below api:

# Enable Home Assistant API
api:
 services:
   service: set_dsmr_key
   variables:
     private_key: string
   then:
     - logger.log:
         format: Setting private key %s. Set to empty string to disable
         args: [private_key.c_str()]
     - globals.set:
         id: has_key
         value: !lambda "return private_key.length() == 32;"
     - lambda: |-
         if (private_key.length() == 32)
           private_key.copy(id(stored_decryption_key), 32);
         id(dsmr_instance).set_decryption_key(private_key);

In Home Assistant go to Services and select the service ESPHome: {name}_set_dsmr_key. There fill in the code received from the provider: SlimmeLezer_set_key

Different uart

The SlimmeLezer is built with a logic inverter on the pcb. Connecting that directly to the Rx of the Wemos, causes that it can't be flashed via USB as it constanly pulls the Rx either high or low. Therefor I'm using the 2nd uart, on pin D7. That's why the uart is specified on pin D7 in the code:

uart:
  baud_rate: 115200
  rx_pin: D7

dsmr's People

Contributors

frenck avatar glmnet avatar jesserockz avatar klaasnicolaas avatar olafz avatar zuidwijk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.