How to set up SlimmeLezer with Home Assistant for dummies

UPDATE: Marcel has added a nice setup instruction on his site here: initial setup slimmelezer Please try that first before going off on a wild tangent like I did. In case it still helps someone else stuck with another topic, I’ve left my initial dive into updating the .yaml below.

I was pretty excited when the new energy management features of Home Assistant were added in 2021.7, and immediately ordered the afformentioned “SlimmeLezer” ESPHome device to get up and running. However, the device arrived without any sort of documentation, I didn’t know what ESPHome was, and I struggled to get everything hooked up properly over the course of a few days. In case it helps somebody else in a similar boat, here’s what I did to get the SlimmeLezer talking to Home Assistant. As of this writing, I’m running Home Assistant OS on a RPi 4 with core version 2021.8.7.

First of all, Marcel Zuidwijk’s SlimmeLezer is an ESPHome device, so you need to install the ESPHome addon via Supervisor in Home Assistant. Next, SlimmeLezer provides a default “slimmelezer.yaml” configuration for uploading to the device via ESPHome. This can be found here on github:

When I tried to load the yaml file onto the SlimmeLezer using the documentation provided on ESPHome for Home Assistant, the device did not show up via USB, and I couldn’t figure out how to get the HTTPS thing working. So instead, I followed the instructions here, and headed over to to download the precompiled binary (I’m using a MacBook so that’s the one I chose).

When trying to launch ESPHome-flasher, I still had this issue: In order to solve it, something needs to happen in Terminal. So I launched the Terminal app on my MacBook, and entered in the below line of code. I’m not sure if it was necessary, but I copied the application from the downloaded and extracted .zip file into my applications folder on the MacBook up front.

chmod +x /Applications/

Next hurdle was to remove the block put on by my MacBook because the app was from an unidentified developer. After the error pops up once, head over to System Preferences security settings and allow it to open anyway.

Now, ESPHome-flasher is used to upload a .bin firmware file to an ESPHome device, so I needed that first. I used the .yaml mentioned here (replacing $$$wifissid$$$ and $$$password$$$ with the real ones for my home wifi network, and a different passford for ota) as a first test to get the device connected to Home Assistant before setting it up with the full sample .yaml config file from github. Note that it is not possible to change the ota password “over the air”, so that password must stay constant for future updates unless connecting the ESPHome device again directly via USB.

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

  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  password: "$$$password$$$"


  ssid: "$$$wifissid$$$"
  password: "$$$password$$$"
  fast_connect: true

Via the ESPHome addon for Home Assistant, I created a new node for SlimmeLezer, pasted the .yaml code above into the “edit” function, and clicked on intall → “manual download” to generate a .bin file which was automatically downloaded to my MacBook (see here). ESPHome-flasher wasn’t recognizing and serial ports with the first USB cable I tried (perhaps that’s why I needed to use ESPHome-flasher in the first place), so I tried a different one and that worked.

Next I went back over to the ESPHome addon in the Home Assistant Supervisor tab and launched the web UI. The SlimmeLezer node I had created still reported as “offline” so I power cycled the SlimmeLezer device. Unfortunately still no luck, turns out I had entered the wifi password incorrectly in my slimmelezer.yaml file. After correcting that, recreating the .bin file and flashing it to the SlimmeLezer with ESPHome-flasher, I checked my wifi router config and was able to locate the mac address of the SlimmeLezer (you can find this in the ESPHome log while it’s flashing your .bin file), so it was at least connecting to the network.

Back over in the Home Assistant Supervisor ESPHome addon, the node was now reporting online!

Now I’ve installed the SlimmeLezer at my smart meter with the P1 cable (and power over USB since my meter is DSMR version 4). I can then use the over the air (OTA) update function of ESPHome to add in the full template .yaml file from github. That was also a bit confusing, so here below is what I actually used (this time I used ESPHome’s secrets.yaml function to specify secure passwords & wifi SSID). Some things are commented out which I don’t need or seemed to help to get the SlimmeLezer recognized as “online” in Home assistant.

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

  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  board: d1_mini
  #esp8266_restore_from_flash: true
  #name_add_mac_suffix: true
  #  name: zuidwijk.slimmelezer
  #  version: "1.0"
  #  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'"

  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

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


# Enable logging

# Enable Home Assistant API
  #  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);

  password: !secret ota_password

  port: 80

  baud_rate: 115200
  rx_pin: D7

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

  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'

# selection of sensors from 
  - platform: dsmr
    #  name: "Energy Consumed Luxembourg"
      name: "Energy Consumed Tariff 1"
      name: "Energy Consumed Tariff 2"
    #  name: "Energy Produced Luxembourg"
      name: "Energy Produced Tariff 1"
      name: "Energy Produced Tariff 2"
      name: "Power Consumed"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Power Produced"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Electricity Failures"
      icon: mdi:alert
      name: "Long Electricity Failures"
      icon: mdi:alert
      name: "Voltage Phase 1"
      name: "Voltage Phase 2"
      name: "Voltage Phase 3"
      name: "Current Phase 1"
      name: "Current Phase 2"
      name: "Current Phase 3"
      name: "Power Consumed Phase 1"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Power Consumed Phase 2"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Power Consumed Phase 3"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Power Produced Phase 1"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Power Produced Phase 2"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Power Produced Phase 3"
      accuracy_decimals: 0
        - multiply: 1000
      name: "Gas Consumed"
    #  name: "Gas Consumed Belgium"
  - platform: uptime
    name: "Uptime"
  - platform: wifi_signal
    name: "Wi-Fi Signal"
    update_interval: 60s

  - platform: dsmr
      name: "DSMR Identification"
      name: "DSMR Version"
    #  name: "DSMR Version Belgium"
  - platform: wifi_info
      name: "IP Address"
      name: "Wi-Fi SSID"
      name: "Wi-Fi BSSID"

I am not sure why you are changing the yamls?
I just got mine and I just powered it, connected to the “slimmelezer” Wifi network on my phone (seemed to take a while before that was up and running) provided Wifi password for my home network and it appeared in Home Assistant. No need to mess with yamls.

1 Like

In case the ESPhome module fails to connect to your wifi router (f.e. your router died, and you had to replace it), the module will act as a hotspot.
You can connect a client (phone/laptop) to this wifi hotspot, which will allow you to correct the module and update the configuration. You can also upload it with another bin file if you like :wink:

Ah cool, thanks for the info!

That sounds much simpler than what I did. Is there some kind of documentation for that somewhere?

I don’t think there is documentation on how to setup. I read on the SlimmeLezer website that it has ESPHome preinstalled so I assumed it should “just work”. Since most Wifi devices I have seen create their own accesspoint to enable setup I just tried it and it worked out (altough it seemed to take a minute or 2 for the accesspoint to become active).

I think a short note about this on the SlimmeLezer website would have been nice.

I am not a total noob, but this is not obvious TBH. Connecting to the ‘slimmelezer’ wifi hotspot is not obvious. I would definately recommend some how-to for more people to be able to enjoy this.

I am not getting it to work at all. Adding the sensors, there is an error about the rx_pin D7 pin not being available on this board. :frowning:

You are probably having issues because the wrong uart is used. In the official slimmelezer.yaml there is a section to configure the uart on a different pin. This is mentioned in the readme. See quote below.

You might want to try to contact the seller to ask for some help, not sure if he is monitoring these forums. For me the original slimmelezer.yaml just worked. I just updated my slimmelezer with it.

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:

 baud_rate: 115200
 rx_pin: D7
1 Like


I was connecting it to the HA server itself and installing it from the ESPhome dashboard which is not the way to go. Flashed the firmware from the zuidwijk productpage with esphome-flasher and connected to the WiFi hotspot it’s setting up by default, when first powering up. Things look better. I’m getting readings in the sensor entities, but the energy dashboard itself is reporting ‘Unexpected state class’.

After taking the slimmelezer.yaml from the sensors ARE showing readings, but the slimmelezer is offline in ESPhome dashboard, which makes it hard to check logs or make edits. What am I doing wrong?

Fixed. The nice gentleman behind the SlimmeLezer module pointed out to me if the SlimmeLezer node is offline in ESPhome Dashboard, connect to it directly and remove the following line from your slimmelezer.yaml:

name_add_mac_suffix: true

Ah cool thanks. While trying to start over from the beginning again to make a nicer “how to” I ended up in the same situation.

Hi, I don’t understand the hardware, does it get the power from a clamp?

It gets power directly from the smart meter’s P1 port for DSMR version 5, otherwise 5V over micro-USB is needed in addition to the P1 connection. Note that this device will only work with a compatible smart meter.

Clear, thanks.
Have you any idea how to check if a smart meter is compatible? Is there any list, by provider, by meter type?

Yeah, that line changes the name of the node (it adds “-somenumber” to the name). I solved it by creating a new node in ESPHome with that name and removed the old one.

Mainly did it this way so in the future I can keep copy-pasting the official slimmelezer.yaml. Otherwise it will break again if I forget to remove that line.

Marcel has added a nice simple setup instruction on his site here: Initial setup SlimmeLezer – Marcel Zuidwijk I’ll update the original post to send people there instead. Now to see if I can find a way to start over from the beginning…

I haven’t seen a list of compatible meters anywhere, but I suggest you start here: Integrating your electricity grid - Home Assistant

For meters that don’t use the DSMR protocol (which SlimmeLezer requires), there are also other options like the “glow” or “CT clamp” sensors described at that link. In the end, however, any method that gets the expected entity type and units into Home Assistant will do the job.

Everything works fine except gas readings (Status unknown). Anyone knows how to configure this?