Slimmelezer.yaml not working

Yesterday I got my SlimmeLezer in the mail and today I tried installing it. Since it came with no instructions I thought I had to create a configuration using the ESPHome addon using this: slimmelezer.yaml.
Edited the file to contain the WiFi SSID and key and tried installing it.
That did sort of work, it flashed fine but it did not connect to WiFi. Status of it is offline.
So, I am doing something wrong. Probably something simple. Can somebody help me?

How did you flash it?

1 Like

Using the ESPHome addon in home assistant

I meant with which device. Via the browser https direct method or is it connected via an UART to the HA itself? and what did the log say?

Did you disconnect it from the UART before resetting it? Sometimes it will not boot when still connected.

Also: GitHub - zuidwijk/dsmr

1 Like

Via the browser with the device connected via a USB cable to the RPi4.

I will try replugging the device

Unfortunately that did not solve my issue. No new device in my wireless network :frowning:

What does the log say after the upload?
Just load in the code from ESPHome.

Also do you have a secret file or did you remove the !secret from the code you pasted

1 Like

This is the yaml I am installing

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

esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: true
  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: "SSID"
      password: "WirelessKey"

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

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"
    energy_delivered_tariff1:
      name: "Energy Consumed Tariff 1"
    energy_delivered_tariff2:
      name: "Energy Consumed Tariff 2"
    energy_returned_lux:
      name: "Energy Produced Luxembourg"
    energy_returned_tariff1:
      name: "Energy Produced Tariff 1"
    energy_returned_tariff2:
      name: "Energy Produced Tariff 2"
    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"
    gas_delivered_be:
      name: "Gas Consumed Belgium"
  - 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"

It outputs this:

INFO Reading configuration /config/esphome/slimme-lezer.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/slimmelezer
Processing slimmelezer (board: d1_mini; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.20800.0 (2.8.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)
Library Manager: Installing Update
Library Manager: Already installed, built-in library
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 1.3.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <Crypto> 0.2.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <Dsmr> 0.3.0
|-- <Crypto> 0.2.0
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
Retrieving maximum program size /data/slimmelezer/.pioenvs/slimmelezer/firmware.elf
Checking size /data/slimmelezer/.pioenvs/slimmelezer/firmware.elf
RAM:   [====      ]  43.0% (used 35220 bytes from 81920 bytes)
Flash: [====      ]  43.6% (used 455188 bytes from 1044464 bytes)
========================= [SUCCESS] Took 9.72 seconds =========================
INFO Successfully compiled program.
INFO Running:  esptool.py --before default_reset --after hard_reset --baud 460800 --chip esp8266 --port /dev/ttyUSB1 write_flash 0x0 /data/slimmelezer/.pioenvs/slimmelezer/firmware.bin
esptool.py v3.1
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 3c:61:05:d1:99:6a
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00070fff...
Compressed 459344 bytes to 313425...
Wrote 459344 bytes (313425 compressed) at 0x00000000 in 7.4 seconds (effective 494.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB1 with baud rate 115200
[20:07:16]\033Ğ\xc4\x90\xec\x92\xc7r\xdc;\x88\xfc\x82n\xc4b\xe0[I][logger:170]: Log initialized

Well, lets first of all check if it connects: (Only use this code, not the rest)

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

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

logger:

wifi:
  ssid: "wifissid"
  password: "password"
  fast_connect: true

Fill in the ota, ssid and pw so you can see if it connects.
ota only needed if you want to use wifi upload for next tests.

Looking at the code.

wifi:
  networks:
    - ssid: "SSID"
      password: "WirelessKey"

Stands out as a format never saw in my codes. But could be old code.
Also look at the ESPHome link, the code for reading out is updated as its integrated in ESPHome now.
Are you located in Luxembourg?

1 Like

I am located in the Netherlands so the whole part about the decryption key can be dropped.

According to this the wifi syntax seems fine.

Now it connects :partying_face:

INFO Successfully compiled program.
INFO Running:  esptool.py --before default_reset --after hard_reset --baud 460800 --chip esp8266 --port /dev/ttyUSB1 write_flash 0x0 /data/slimmelezer/.pioenvs/slimmelezer/firmware.bin
esptool.py v3.1
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: 3c:61:05:d1:99:6a
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00051fff...
Compressed 335024 bytes to 239973...
Wrote 335024 bytes (239973 compressed) at 0x00000000 in 5.7 seconds (effective 466.7 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB1 with baud rate 115200
[20:49:16]\033Ğ\x84\x90\xec\x92\xc7r\xdc;\x88\xfc\x82n\xc4b\xe0[I][logger:170]: Log initialized
[20:49:16][C][ota:378]: There have been 0 suspected unsuccessful boot attempts.
[20:49:16][I][app:029]: Running through setup()...
[20:49:16][C][wifi:037]: Setting up WiFi...
[20:49:16][I][wifi:250]: WiFi Connecting to [redacted]...
[20:49:20][I][wifi:513]: WiFi Connected!
[20:49:20][C][wifi:359]:   SSID: [redacted]
[20:49:20][C][wifi:360]:   IP Address: 192.168.0.102
[20:49:20][C][wifi:362]:   BSSID: [redacted]
[20:49:20][C][wifi:363]:   Hostname: 'slimmelezer'
[20:49:20][C][wifi:367]:   Signal strength: -36 dB ▂▄▆█
[20:49:20][C][wifi:371]:   Channel: 1
[20:49:20][C][wifi:372]:   Subnet: 255.255.255.0
[20:49:20][C][wifi:373]:   Gateway: 192.168.0.1
[20:49:20][C][wifi:374]:   DNS1: 192.168.0.1
[20:49:20][C][wifi:375]:   DNS2: (IP unset)
[20:49:20][C][ota:029]: Over-The-Air Updates:
[20:49:20][C][ota:030]:   Address: 192.168.0.150:8266
[20:49:20][C][ota:032]:   Using Password.
[20:49:20][I][app:060]: setup() finished successfully!
[20:49:20][I][app:106]: ESPHome version 2021.8.2 compiled on Aug 29 2021, 20:48:20
[20:49:20][C][wifi:499]: WiFi:
[20:49:20][C][wifi:359]:   SSID: [redacted]
[20:49:20][C][wifi:360]:   IP Address: 192.168.0.102
[20:49:20][C][wifi:362]:   BSSID: [redacted]
[20:49:20][C][wifi:363]:   Hostname: 'slimmelezer'
[20:49:20][C][wifi:367]:   Signal strength: -35 dB ▂▄▆█
[20:49:20][C][wifi:371]:   Channel: 1
[20:49:20][C][wifi:372]:   Subnet: 255.255.255.0
[20:49:20][C][wifi:373]:   Gateway: 192.168.0.1
[20:49:20][C][wifi:374]:   DNS1: 192.168.0.1
[20:49:20][C][wifi:375]:   DNS2: (IP unset)
[20:49:20][C][logger:189]: Logger:
[20:49:20][C][logger:190]:   Level: DEBUG
[20:49:20][C][logger:191]:   Log Baud Rate: 115200
[20:49:20][C][logger:192]:   Hardware UART: UART0
[20:49:20][C][ota:029]: Over-The-Air Updates:
[20:49:20][C][ota:030]:   Address: 192.168.0.150:8266
[20:49:20][C][ota:032]:   Using Password.

So my guess is that it is a typo somewhere. Going to try adding in a few extra lines at a time.

I do not have a secret file

This is my current yaml. The weird thing is, EPSHome dashboard does not see it but I can connect to the static ip address :confused:

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

esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  esp8266_restore_from_flash: true
  board: d1_mini
  name_add_mac_suffix: true
  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:
  ssid: [redacted]
  password: [redacted]
  fast_connect: true
  manual_ip:
    static_ip: 192.168.0.150
    gateway: 192.168.0.1
    subnet: 255.255.255.0
    dns1: 192.168.0.1

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

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"
#    energy_delivered_tariff1:
#      name: "Energy Consumed Tariff 1"
#    energy_delivered_tariff2:
#      name: "Energy Consumed Tariff 2"
#    energy_returned_lux:
#      name: "Energy Produced Luxembourg"
#    energy_returned_tariff1:
#      name: "Energy Produced Tariff 1"
#    energy_returned_tariff2:
#      name: "Energy Produced Tariff 2"
#    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"
#    gas_delivered_be:
#      name: "Gas Consumed Belgium"
#  - 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"

Enabling anything else and the yaml is not valid or if it is, the device seems to hang on boot.

Of course it wont show up in HA as you have not enabled the api.
And you are still not using the code from the ESPHome but the original code you linked.

So a couple of things:

  • api is not set, so in integration it will not show up.
  • You will need to figure out what info you want to have and make the yaml file according to that.
  • Trim that code a bit. Still alot of stuff in there that is pointless. Like the wifi_info.

First part of the code:

esphome:
  name: slimmelezer
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: "password"

wifi:
  ssid: "ssid"
  password: "password"
  fast_connect: true

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "slimmelezer"
    password: "g6ThtO24Kc4M"

captive_portal:

This will set the name and rest of the basic info to boot and be reachable, and connect to HA

For the rest of the code you will need to add the sensors and whatever else you want.

sensor:
  - platform: dsmr
    energy_delivered_tariff1:
      name: Verbruik Tarief Laag
    energy_delivered_tariff2:
      name: Verbruik Tarief Hoog

Adjust and add whatever sensors you want in to show up in HA

1 Like

Hey did you get this working with the slimmelezer.yaml template from GitHub? I think I’m having the same issue over here: How to set up Slimmelezer with Home Assistant for dummies

When I use this slimmelezer.yaml:

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

esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  board: d1_mini

# Enable logging
logger:

# Enable Home Assistant API
api:

ota:
  password: !secret ota_password

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

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret ap_password

captive_portal:

web_server:
  port: 80

uart:
  baud_rate: 115200
  rx_pin: D7

dsmr:
  id: dsmr_instance

Then the logging always hangs at this point. I’ve tried pairing down the yaml a lot to narrow down the root cause but no luck so far. Will try to go further later.

INFO Reading configuration /config/esphome/slimmelezer.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d /config/esphome/slimmelezer
Processing slimmelezer (board: d1_mini; framework: arduino; platform: platformio/[email protected])
--------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 4MB Flash
PACKAGES: 
 - framework-arduinoespressif8266 3.20704.0 (2.7.4) 
 - tool-esptool 1.413.0 (4.13) 
 - tool-esptoolpy 1.20800.0 (2.8.0) 
 - toolchain-xtensa 2.40802.200502 (4.8.2)
Library Manager: Installing Update
Library Manager: Already installed, built-in library
Dependency Graph
|-- <ESPAsyncTCP-esphome> 1.2.3
|   |-- <ESP8266WiFi> 1.0
|-- <ESPAsyncWebServer-esphome> 1.3.0
|   |-- <ESPAsyncTCP-esphome> 1.2.3
|   |   |-- <ESP8266WiFi> 1.0
|   |-- <Hash> 1.0
|   |-- <Crypto> 0.2.0
|   |-- <ESP8266WiFi> 1.0
|   |-- <ArduinoJson-esphomelib> 5.13.3
|-- <ESP8266WiFi> 1.0
|-- <ESP8266mDNS> 1.2
|   |-- <ESP8266WiFi> 1.0
|-- <ArduinoJson-esphomelib> 5.13.3
|-- <Dsmr> 0.3.0
|-- <Crypto> 0.2.0
|-- <DNSServer> 1.1.1
|   |-- <ESP8266WiFi> 1.0
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/api_connection.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/api_pb2_service.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/api_server.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/list_entities.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/proto.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/subscribe_state.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/user_services.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/api/util.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/captive_portal/captive_portal.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/dsmr/dsmr.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/logger/logger.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/ota/ota_component.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/sensor/automation.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/uart/uart.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/uart/uart_esp32.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/uart/uart_esp8266.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/web_server/web_server.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/web_server_base/web_server_base.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/wifi/wifi_component.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/wifi/wifi_component_esp32.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/components/wifi/wifi_component_esp8266.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/application.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/application_esp32.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/application_esp8266.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/component.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/controller.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/esphal.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/log.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/preferences.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/esphome/core/util.cpp.o
Compiling /data/slimmelezer/.pioenvs/slimmelezer/src/main.cpp.o
Linking /data/slimmelezer/.pioenvs/slimmelezer/firmware.elf
Retrieving maximum program size /data/slimmelezer/.pioenvs/slimmelezer/firmware.elf
Building /data/slimmelezer/.pioenvs/slimmelezer/firmware.bin
Checking size /data/slimmelezer/.pioenvs/slimmelezer/firmware.elf
RAM:   [====      ]  40.7% (used 33320 bytes from 81920 bytes)
Flash: [====      ]  40.5% (used 422508 bytes from 1044464 bytes)
Creating BIN file "/data/slimmelezer/.pioenvs/slimmelezer/firmware.bin" using "/root/.platformio/packages/framework-arduinoespressif8266/bootloaders/eboot/eboot.elf" and "/data/slimmelezer/.pioenvs/slimmelezer/firmware.elf"
========================= [SUCCESS] Took 40.76 seconds =========================
INFO Successfully compiled program.
INFO Running:  esptool.py --before default_reset --after hard_reset --baud 460800 --chip esp8266 --port /dev/ttyUSB1 write_flash 0x0 /data/slimmelezer/.pioenvs/slimmelezer/firmware.bin
esptool.py v3.1
Serial port /dev/ttyUSB1
Connecting....
Chip is ESP8266EX
Features: WiFi
Crystal is 26MHz
MAC: bc:ff:4d:1a:34:10
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 460800
Changed.
Configuring flash size...
Flash will be erased from 0x00000000 to 0x00068fff...
Compressed 426656 bytes to 296420...
Wrote 426656 bytes (296420 compressed) at 0x00000000 in 7.3 seconds (effective 470.0 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...
INFO Successfully uploaded program.
INFO Starting log output from /dev/ttyUSB1 with baud rate 115200
[08:51:57]bl`\x9cb\x8el\x92lr\x92`\xfc\x82nb\xe0[I][logger:170]: Log initialized

Update: Not sure why, but I got it working with this yaml:

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

esphome:
  name: ${device_name}
  comment: "${device_description}"
  platform: ESP8266
  board: d1_mini
  #esp8266_restore_from_flash: true
  #name_add_mac_suffix: true
  #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:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: true

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: ${device_name}
    password: !secret ap_password

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:
  password: !secret ota_password

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'

# selection of sensors from 
# https://github.com/zuidwijk/dsmr/blob/2a60634ab628626951736d404878e1361c23868b/slimmelezer.yaml
sensor:
  - platform: dsmr
    #energy_delivered_lux:
    #  name: "Energy Consumed Luxembourg"
    energy_delivered_tariff1:
      name: "Energy Consumed Tariff 1"
    energy_delivered_tariff2:
      name: "Energy Consumed Tariff 2"
    #energy_returned_lux:
    #  name: "Energy Produced Luxembourg"
    energy_returned_tariff1:
      name: "Energy Produced Tariff 1"
    energy_returned_tariff2:
      name: "Energy Produced Tariff 2"
    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"
    #gas_delivered_be:
    #  name: "Gas Consumed Belgium"
  - 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"
1 Like

You are absolutely right. Stubborn first timer here :sweat_smile:

I think we both like to mess around with things. This information is also in your thread, but upload the default yaml, connect it to your smart power meter, log into it using your phone, enter wifi credentials and simply wait for it to show up in home assistant. No need to mess around with yaml’s.

This will not work for me, without the dsmr: declaration.
That will not work without the uart: entry.
That gives me an error on the D7 pin.
I’m lost atm :frowning:

Update: 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 things look better. I’m getting readings in the sensor entities, but the energy dashboard itself is reporting ‘Unexpected state class’.

There were some changes in HA 2021.9 for the state_class of energy sensors. That got also changed with the latest firmware of slimmelezer (I think 2 days ago).

The firmware in my slimmelezer worked with HA 2021.8, but gave a similar error about state_class after updating HA to 2021.9. This was solved by updating slimmelezer firmware (I used the yaml from Github, but OTA file from product page should also work).