SlimmeLezer configuration

The default firmware comes with all fields/sensors added, so everybody should be able to use it immediately. If you want to use your own ESPHome config (which I encourage anybody to do), find below the yaml configuration I’m using.

Please do note that I used to use ‘name_add_mac_suffix: true‘ which makes every device have an unique name. Because 99,9% will be using only one, I’ve changed that to ‘name_add_mac_suffix: false‘. Now every device will be called slimmelezer (and therefore slimmelezer.local within Home Assistant).

---
substitutions:
  device_name: slimmelezer
  device_description: "DIY P1 module to read your smart meter"

#external_components:
#  - source: github://zuidwijk/dsmr
    
esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: false
  project:
    name: zuidwijk.slimmelezer
    version: "1.0"
  on_boot:
    then:
      - if:
          condition:
            lambda: return id(has_key);
          then:
            - lambda: |-
                std::string key(id(stored_decryption_key), 32);
                id(dsmr_instance).set_decryption_key(key);
          else:
            - logger.log:
                level: info
                format: "Not using decryption key. If you need to set a key use Home Assistant service 'ESPHome:  ${device_name}_set_dsmr_key'"

wifi:
  networks:
    - ssid: "my-wifi-network"
      password: "mySecretPassword"

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    ap_timeout: 15s

captive_portal:

# Enable logging
logger:

# 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);

ota:

web_server:
  port: 80

uart:
  baud_rate: 115200
  rx_pin: D7

globals:
  - id: has_key
    type: bool
    restore_value: yes
    initial_value: "false"
  - id: stored_decryption_key
    type: char[32]
    restore_value: yes

dsmr:
  id: dsmr_instance
  # For Luxembourg users set here your decryption key
  #decryption_key: !secret decryption_key // enable this when using decryption for Luxembourg; key like '00112233445566778899AABBCCDDEEFF'

sensor:
  - platform: dsmr
    energy_delivered_lux:
      name: "Energy Consumed Luxembourg"
      state_class: total_increasing
    energy_delivered_tariff1:
      name: "Energy Consumed Tariff 1"
      state_class: total_increasing
    energy_delivered_tariff2:
      name: "Energy Consumed Tariff 2"
      state_class: total_increasing
    energy_returned_lux:
      name: "Energy Produced Luxembourg"
      state_class: total_increasing
    energy_returned_tariff1:
      name: "Energy Produced Tariff 1"
      state_class: total_increasing
    energy_returned_tariff2:
      name: "Energy Produced Tariff 2"
      state_class: total_increasing
    power_delivered:
      name: "Power Consumed"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned:
      name: "Power Produced"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    electricity_failures:
      name: "Electricity Failures"
      icon: mdi:alert
    electricity_long_failures:
      name: "Long Electricity Failures"
      icon: mdi:alert
    voltage_l1:
      name: "Voltage Phase 1"
    voltage_l2:
      name: "Voltage Phase 2"
    voltage_l3:
      name: "Voltage Phase 3"
    current_l1:
      name: "Current Phase 1"
    current_l2:
      name: "Current Phase 2"
    current_l3:
      name: "Current Phase 3"
    power_delivered_l1:
      name: "Power Consumed Phase 1"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_delivered_l2:
      name: "Power Consumed Phase 2"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_delivered_l3:
      name: "Power Consumed Phase 3"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned_l1:
      name: "Power Produced Phase 1"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned_l2:
      name: "Power Produced Phase 2"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    power_returned_l3:
      name: "Power Produced Phase 3"
      accuracy_decimals: 0
      filters:
        - multiply: 1000
    gas_delivered:
      name: "Gas Consumed"
      state_class: total_increasing
    gas_delivered_be:
      name: "Gas Consumed Belgium"
      state_class: total_increasing
  - platform: uptime
    name: "Uptime"
  - platform: wifi_signal
    name: "Wi-Fi Signal"
    update_interval: 60s

text_sensor:
  - platform: dsmr
    identification:
      name: "DSMR Identification"
    p1_version:
      name: "DSMR Version"
    p1_version_be:
      name: "DSMR Version Belgium"
  - platform: wifi_info
    ip_address:
      name: "IP Address"
    ssid:
      name: "Wi-Fi SSID"
    bssid:
      name: "Wi-Fi BSSID"
  - platform: version
    name: "ESPHome Version"
    hide_timestamp: true

41 comments

  1. Bostjan

    While waiting for a delivery of my SlimmeLezer I have three questions:
    1. You write “The default firmware comes with all fields/sensors added”. Are the ones in your config all possible sensors or are there more already available, just not listed in your config?
    2. Is there a list of all available sensors?
    3. Namely, I would need the sensor for current electricity tariff (low or high). Do I just add it to the ESPHome under “sensor” like this:

    sensor:
    – platform: dsmr
    electricity_tariff:
    name: “Current tariff”

    or are there further code adaptations needed (for example in fields.h or similar)?

    1. almodovaris

      Add this to configuration.yaml:

      utility_meter:
      daily_energy_offpeak:
      source: sensor.energy_consumed_tariff_1
      name: Daily Energy (Offpeak)
      cycle: daily
      daily_energy_peak:
      source: sensor.energy_consumed_tariff_2
      name: Daily Energy (Peak)
      cycle: daily
      daily_gas:
      source: sensor.gas_consumed
      name: Daily Gas
      cycle: daily
      monthly_energy_offpeak:
      source: sensor.energy_consumed_tariff_1
      name: Monthly Energy (Offpeak)
      cycle: monthly
      monthly_energy_peak:
      source: sensor.energy_consumed_tariff_2
      name: Monthly Energy (Peak)
      cycle: monthly
      monthly_gas:
      source: sensor.gas_consumed
      name: Monthly Gas
      cycle: monthly

      sensor:
      – platform: template
      sensors:
      daily_energy:
      friendly_name: Daily Energy
      unit_of_measurement: kWh
      value_template: “{{ states(‘sensor.daily_energy_offpeak’)|float + states(‘sensor.daily_energy_peak’)|float }}”
      monthly_energy:
      friendly_name: Monthly Energy
      unit_of_measurement: kWh
      value_template: “{{ states(‘sensor.monthly_energy_offpeak’)|float + states(‘sensor.monthly_energy_peak’)|float }}”

  2. Kasper

    Hi,

    I got the slimmelezer today. After connecting it to the wifi/homeassistant I got no readouts everything is ‘unknown’ It is connected to the P1 port to a belgian digital meter is there something I need to change first ?

    1. Marcel

      Thats due to an issue with the “invalid string length” I’m guessing: https://github.com/esphome/esphome/pull/2157
      The only workaround I know that works, is using esp-link instead of esphome. That can be downloaded on the productpage and should work. Then you need to use the dsmr integration with the ip of the device and port 23 (telnet)

  3. Victor

    Hi Marcel,

    I got the SlimmeLezer today and connected it to the p1 and then integrated it with the DSMR2.2 firmware to HomeAssistant.
    I got readings for energy-produced and -consumed (both tariffs), power-produced and -consumed, a dsmr-identification ISk5\2ME382-1004,
    ***but no GAS consumed (=onbereikbaar).
    ***Also these entities do not appear in the “energy-management dashboard entities-list”, so I can not add them to the HA energy-dashboard.
    What to do?

    Kind regards, Victor

      1. Victor

        Gasstanden heb ik inmiddels binnen via de hack van Michiel Appelman. Het enige wat nog niet werkt is toevoegen aan het energiedashboard in HA.
        Ik zie wel dat er inmiddels een nieuwe Fix is hiervoor op de productpagina.
        Komt er nog een nieuwe bin met een Fix voor dsmr2.2?

      2. Anthony

        Werkt hier niet, ik krijg alleen maar unavailable.

        Ik heb geen DSMR 5.0, maar volgens mij DSMR 2.2. Ik begrijp dat ik iets moet aanpassen vanuit Github, maar snap niet precies wat. Kun je me op weg helpen?

  4. Anthony van de Koppel

    Inmiddels heb ik het deels werkend met de DSMR 2.x firmware. Echter krijg ik nog niet alle waardes door;

    Waardes welke ik wel doorkrijg;
    Energy Consumed Tariff 1
    Energy Consumed Tariff 2
    Energy Produced Tariff 1
    Energy Produced Tariff 2
    Power Consumed
    Power Produced
    Uptime
    Wi-Fi Signal
    DSMR Identification
    IP Address
    Wi-Fi SSID

    Waardes welke ik niet doorkrijg, maar volgens mij wel zou moeten hebben:
    Voltage Phase 1
    Voltage Phase 2
    Voltage Phase 3
    Current Phase 1
    Current Phase 2
    Current Phase 3
    Power Consumed Phase 1
    Power Consumed Phase 2
    Power Consumed Phase 3

    Ik kan de Slimmelezer ook niet gebruiken voor het nieuwe energy dashboard, hij staat hier niet tussen. Als ik dan klik “Why is my entity not listed?” kom ik op de volgende pagina uit van Home Assistant: https://www.home-assistant.io/more-info/statistics/

    Hier wordt uitgelegd dat de integratie het dan niet ondersteund. Gaat hier nog wel support voor komen, of doe ik wat verkeerd?

    Meter:
    ISk5\2MT382-1003

    ESP:
    Firmware: 1.21.0-dev

    Home assistant:
    core-2021.9.6
    supervisor-2021.09.0

    1. Marcel

      Hoi Anthony, de oudere meters geven deze waardes niet door. Ik heb geprobeerd de specificatie op te zoeken van 2.x, maar kan deze helaas niet zo snel vinden.

  5. Niklas Lanzén

    Hi!
    After updating firmware I can read energy production/consumption. It works great.

    In the post you encourage us to make our own config file, based on one above. I do want to do that but I don’t really understand where to put it.
    I run Home Assistant (core-2021.9.6) and I have the ESPHome addition installed. On the In HA->Configutation->Integration I can see slimmelezer in the esphome box. I can look at the instance but I have no idea of how use my own config file.
    If I click on ESPhome and bring up the web interface I can not see slimmelezer.
    Anyone who can give me a hint?

    1. Marcel

      in the esphome add-on, click on the right bottom “+” and add an esphome config/device. There you add the code (yaml file) 🙂

      1. Victor van den Hoven

        I would like to do the same for my DSMR2.2 meter with ESPHOME 2021.9.0.

        I suppose I only have to change the uart in slimmemeter.yaml into this:
        uart:
        baud_rate: 9600
        data_bits: 7
        parity: EVEN
        stop_bits: 1
        rx_pin: D7

        Anything else?
        What about the gas_delivered_hack?

        1. Marcel

          Unfortunately there is more you need to do… I wish it was that simple! You also need to disable the CRC check (seems not to be present/needed on dsmr 2). Please look into Michiel Appelman’s GitHub

        2. Victor van den Hoven

          Ah ok, now I see the external component part in his yaml.
          I did not know that it could overload the esphome repo this way.

          Thanx, I will try.

  6. Bas

    Marcel, the work you have put into this and the contribution you made to all of our Home Assistant installations is amazing! I have a huge amount of respect for people like you that add so much and ask so little in return! If there is something i can ever assist you with please let me know, again thanks for all the effort you have put into this!

    1. Marcel

      Thanx Bas, highly appreciated! I’m doing this as a passion, as I like to make/build/design stuff. Yet now the passion has become (to) hard working, which I don’t like. So for me it’s a learning process. I’m designing new versions so I can make them faster and have to do less soldering myself. (Took me 3 hours to assemble 30 doorbell’s). There is one thing you can help me with…. documentation and how-to’s. I’ve already wrote a hoot flash page in the FAQ… Other documentation like how to connect to wifi and how to integrate into Home Assistant would be nice. This might sound easy for most of us, yet not all users are familiar with the tech, and for those users I want to make it an easy experience too.

  7. Dennis

    Ik heb de Slimmelezer werkend, en zie de output in HA. Slimmelezer en HA zitten in hetzelfde vlan. Heb de laatste Firmware SlimmeLezer (2021.8.2) with state_class & Invalid length (BE) fix. Wel zie ik in HA deze warnings:

    Logger: homeassistant.components.esphome
    Source: components/esphome/__init__.py:403
    Integration: ESPHome (documentation, issues)
    First occurred: 09:13:23 (4 occurrences)
    Last logged: 09:18:52

    Can’t connect to ESPHome API for slimmelezer (10.0.20.12): Timeout while waiting for API response!
    Can’t connect to ESPHome API for slimmelezer (10.0.20.12): Unexpected error while connecting to slimmelezer @ 10.0.20.12: ‘NoneType’ object has no attribute ‘login’

    Hoe kan ik deze oplossen?

    1. Marcel

      Ik ken deze melding eigenlijk niet. Er zit geen wachtwoord o.i.d. op de OTA/API in de Firmware. Kan je wel pingen van HA naar de SlimmeLezer? Misschien is je device van ip-adres veranderd. Mijn advies in dat geval is om het een fixed ip via DCHP te geven (altijd via DHCP, nooit in device zelf).

  8. Laurens

    Hi Marcel,

    Ik heb de SlimmeLezer zojuist ge-update met de BIN file, maar hoe krijg ik nu de juiste YAML in ESPHOME/Home Assistant?
    Wil graag de wifi instellen aanpassen (static ip o.a.), maar wat is nu de juiste YAML die bij de laatste BIN hoort?

    Groeten,
    Laurens

      1. Laurens

        Bedankt voor je snelle reactie.

        Dat vermoedde ik al, die heb ik nu ook gebruikt.
        Krijg nu alleen steeds de melding

        “[17:16:27][E][dsmr:138]: !9A88
        ^
        Checksum mismatch”

        Gouden tip?

      1. Marcel

        Yves, ik denk dat in Laurens zijn geval het gaat om een oudere type meter (dsmr 2 of 3). Daar zit geen CRC checksum in en gok dat dat de reden van foutmelding is. @Laurens ik heb je gemaild, is makkelijker troubleshooten.

  9. Xavier Jens

    Hoi Marcel,

    De slimme lezer heeft 1,5 weken gewerkt maar geeft sinds vandaag ineens geen data meer door. De lezer heeft geen verbinding meer met wifi, de slimme lezer is niet meer zichtbaar in mijn netwerk.
    Ik heb de lezer even los gekoppeld en weer opnieuw aangesloten. Helaas helpt dit niet. Het maakt niet uit of ik de lezer via de P1 poort of via usb van voeding voorzie. Is de slimme lezer te resetten zodat ik deze opnieuw kan aanmelden op mijn wifi netwerk?

    Groeten,
    Xavier

    1. Marcel

      Ik heb je latere berichtjes ook al gezien. Als de SlimmeLezer dood is, kan ik deze gewoon voor je omruilen als je dat wil. (sorry voor mijn late reactie, ben de laatste 250 backorders aan het maken en verwerken).

  10. Xavier Jens

    Hallo Marcel,

    Sinds gisteren werkt de slimme lezer niet meer.
    Heeft 1,5 weken zonder problemen gewerkt maar ineens geen data meer.
    De slimme lezer is ook niet meer zichtbaar in mijn wifi netwerk.
    Lezer 1 minuut spanningsloos gemaakt en opnieuw aangesloten, helaas zonder resultaat. Ook met extra voeding via usb geen resultaat.
    Heb je nog suggesties om de slimme lezer weer werkend te krijgen?

    Groeten,
    Xavier

    1. Xavier Jens

      Hoi Marcel,

      Probleem is opgelost, de behuizing is vrij makkelijk te openen en heb de spanningen gecontroleerd.
      Zag dat de 3,3V ontbrak, opgelost door een extra spanningsregelaar op het printje te solderen.
      Slimme lezer werkt weer.

      Groeten,
      Xavier

      1. Marcel

        Hey Xavier, als je een kapotte SlimmeLezer hebt, ruil ik deze uiteraard voor je om. Maar ik begrijp dus dat het eerst gewerkt heeft en daarna niet meer? Dus de 3v regelaar op de Wemos is dood? Dat is wel even goed om te weten voor mij.

Leave a Reply

Your email address will not be published. Required fields are marked *