[RELEASE] dsmr-custom: Universal ESPHome Component for DSMR-compatible Smart Meters

Hello everyone,

I’m excited to share dsmr-custom, an enhanced ESPHome component for reading P1 port data from smart meters. It was born out of the need to reliably support Finnish meters (SESKO standard), but it has been built with flexibility in mind to support a wide range of DSMR-compatible meters, including experimental support for encrypted telegrams.

The key to this component is a diagnostics-first workflow. This guide will first show you the most stable way to discover every OBIS code your specific meter provides, and then how to build a powerful, custom configuration based on that data.


Getting Started: The 3-Step Guide

Follow these steps to get up and running reliably. This process is designed to prevent common issues like device crashes on platforms with limited memory like the ESP8266.

Step 1: Add the Component to ESPHome

You don’t need to copy any files. Simply add the following external_components block to your device’s YAML configuration. ESPHome will automatically download the component from GitHub.

external_components:
  - source:
      type: git
      url: https://github.com/nikopaulanne/dsmr-custom
      ref: v1.2.0 # Latest version with ESP-IDF encryption support
    components: [ dsmr_custom ]

Step 2: Discover Your Meter’s OBIS Codes

Next, we’ll use a minimal configuration to safely listen to your meter and print its raw data to the ESPHome logs. This is the most important step.

  1. Use the Diagnostic Configuration Below: Flash your device with this code. Its only job is to listen for one full data packet (a “telegram”) and print it to the logs.

    # In your secrets.yaml, define your WiFi credentials, etc.
    # wifi_ssid: "YourNetwork"
    # ...
    
    esphome:
      name: dsmr-diagnostics
    
    esp8266:
      board: d1_mini
    
    # Add your wifi, api, ota...
    
    logger:
      level: INFO # Necessary to see the log output
    
    uart:
      id: uart_bus
      baud_rate: 115200
      rx_pin: D7 # IMPORTANT: Change to your device's RX pin
      rx_buffer_size: 1700
    
    external_components:
      - source:
          type: git
          url: https://github.com/nikopaulanne/dsmr-custom
          ref: v1.2.0
        components: [ dsmr_custom ]
    
    dsmr_custom:
      id: dsmr_hub
      uart_id: uart_bus
    
    text_sensor:
      - platform: dsmr_custom
        dsmr_custom_hub_id: dsmr_hub
        # This confirms a connection, but the magic happens below.
        identification:
          name: "P1 Telegram Header"
        
        # This captures the full telegram internally and uses a lightweight
        # trigger to print it to the logs without crashing the device.
        telegram:
          internal: true 
          on_value:
            - logger.log:
                level: INFO
                tag: "telegram_dump"
                format: "--- FULL TELEGRAM RECEIVED ---\n%s\n-----------------------------"
                args: [x.c_str()]
    
  2. View the Logs: In Home Assistant, go to Settings > Add-ons > ESPHome, select your device, and click LOGS.

  3. Copy the Data: Wait for a telegram to arrive. You will see a block of text in the logs starting with --- FULL TELEGRAM RECEIVED ---. Copy this entire block. You now have a complete list of every data point your meter provides!

Step 3: Build Your Final Configuration

Now, create your final YAML. Remove the diagnostic on_value trigger and use the OBIS codes you copied from the log to define your own sensors.

dsmr_custom:
  id: dsmr_hub
  uart_id: uart_bus
  # ... other hub settings ...
  
  custom_obis_sensors:
    # Use the codes you discovered in Step 2!
    - code: "1-0:1.8.0"
      name: "Total Energy Import"
      type: sensor
      unit_of_measurement: "kWh"
      device_class: energy
      state_class: total_increasing

    - code: "1-0:31.7.0"
      name: "Phase Current L1"
      type: sensor
      unit_of_measurement: "A"
      device_class: current
      state_class: measurement
      accuracy_decimals: 2

Component Features & Technical Details

  • User-Defined OBIS Sensors: The core feature. You can map any OBIS code from your meter to a sensor in Home Assistant, with full control over its name, unit, icon, and other properties.

  • Broad Protocol Support: The component’s parser is modified for lenient header validation, ensuring it works with standard DSMR, Dutch smart meters, and non-standard Finnish (SESKO) meters.

  • Encrypted Telegram Support: Full AES-128-GCM decryption for both Arduino and ESP-IDF platforms. To enable it, provide the 32-character decryption key.

    dsmr_custom:
      decryption_key: "00112233445566778899AABBCCDDEEFF"
    

    Arduino (ESP8266/ESP32): Stable, using rweather/Crypto library.

    ESP-IDF (ESP32-C6/H2): Hardware-accelerated (10x faster), compile-tested but needs field testing.

    See v1.2.0 release notes for technical details.

  • Buffer and Request Management:

    • Large Buffer: The rx_buffer_size is configurable to handle large telegrams from modern meters.
    • Request Pin: For meters that require a data request signal, you can define a request_pin to actively poll for data.

Call for Community Testing - v1.2.0

:tada: New in v1.2.0: Full ESP-IDF encryption support with hardware acceleration!

Community testing is especially needed for:

  • ESP-IDF Platforms (ESP32-C6/H2): Testing encrypted telegrams with hardware acceleration. Does it work on your meter?
  • Encryption on Arduino: Continue testing encrypted telegrams on ESP8266/ESP32.
  • M-Bus Devices: Verifying OBIS codes for gas, water, or heat meters.
  • Performance: Report battery/power usage and speed improvements on ESP32-C6.

:clipboard: Report your test results - Include hardware model, meter type, and success/failure.


Acknowledgments

This project would not be possible without the foundational work on DSMR parsing and integration from the ESPHome community, including contributions and inspiration from @glmnet, @matthijskooijman, @imars, and @zuidwijk.

A special thank you to the community members in the original HA thread for their testing and feedback.


GitHub Repository: nikopaulanne/dsmr-custom
Discussion: All feedback is welcome – I’m particularly interested in hearing from users with encrypted P1 streams or non-Finnish meters!

3 Likes

Example Configuration (Finnish Meter)

Here is a comprehensive example based on my own working configuration. It includes a large number of OBIS codes commonly found in Finnish Aidon meters. You can use this as a starting point and remove the sensors you don’t need.

The ESP device: Slimmelezer (https://www.zuidwijk.com/product/slimmelezer-plus/)
P1 Telegram Header: ADN9 7534

# Basic ESPHome setup
esphome:
  name: dsmr-reader

esp8266:
  board: d1_mini

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

api:
  encryption:
    key: !secret esphome_api_encryption_key

ota:
logger:

# UART configuration for the P1 port
uart:
  id: uart_bus
  baud_rate: 115200
  rx_pin: D7
  rx_buffer_size: 1700 

# --- External component from GitHub ---
external_components:
  - source:
      type: git
      url: https://github.com/nikopaulanne/dsmr-custom
      ref: v1.2.0 # Supports both Arduino and ESP-IDF
    components: [ dsmr_custom ]

# --- DSMR Custom Hub Configuration ---
dsmr_custom: 
  id: dsmr_hub
  uart_id: uart_bus
  max_telegram_length: 1700 
  crc_check: true
  receive_timeout: "600ms"

  # This is the main feature: define your own sensors!
  custom_obis_sensors:
    # --- Energy readings (kWh) ---
    - code: "1-0:1.8.0"
      name: "Active energy import"
      type: sensor
      unit_of_measurement: "kWh"
      state_class: total_increasing
      device_class: energy
      accuracy_decimals: 3
    - code: "1-0:2.8.0"
      name: "Active energy export"
      type: sensor
      unit_of_measurement: "kWh"
      state_class: total_increasing
      device_class: energy
      accuracy_decimals: 3
    - code: "1-0:3.8.0"
      name: "Reactive energy import"
      type: sensor
      unit_of_measurement: "kvarh"
      state_class: total_increasing
      accuracy_decimals: 3
    - code: "1-0:4.8.0"
      name: "Reactive energy export"
      type: sensor
      unit_of_measurement: "kvarh"
      state_class: total_increasing
      accuracy_decimals: 3

    # --- Power readings (kW / kvar) ---
    - code: "1-0:1.7.0"
      name: "Active power import"
      type: sensor
      unit_of_measurement: "kW"
      device_class: power
      state_class: measurement
      accuracy_decimals: 3
    - code: "1-0:2.7.0"
      name: "Active power export"
      type: sensor
      unit_of_measurement: "kW"
      device_class: power
      state_class: measurement
      accuracy_decimals: 3
    - code: "1-0:3.7.0"
      name: "Reactive power import"
      type: sensor
      unit_of_measurement: "kvar"
      state_class: measurement
      accuracy_decimals: 2
    - code: "1-0:4.7.0"
      name: "Reactive power export"
      type: sensor
      unit_of_measurement: "kvar"
      state_class: measurement
      accuracy_decimals: 2
      
    # --- Per-phase Power readings (kW / kvar) ---
    - code: "1-0:21.7.0"
      name: "Active power L1"
      type: sensor
      unit_of_measurement: "kW"
      device_class: power
      accuracy_decimals: 3
      state_class: measurement
    - code: "1-0:41.7.0"
      name: "Active power L2"
      type: sensor
      unit_of_measurement: "kW"
      device_class: power
      accuracy_decimals: 3
      state_class: measurement
    - code: "1-0:61.7.0"
      name: "Active power L3"
      type: sensor
      unit_of_measurement: "kW"
      device_class: power
      accuracy_decimals: 3
      state_class: measurement
      
    # --- Phase Voltages and Currents ---
    - code: "1-0:32.7.0"
      name: "Phase voltage L1"
      type: sensor
      unit_of_measurement: "V"
      device_class: voltage
      accuracy_decimals: 1
      state_class: measurement
    - code: "1-0:52.7.0"
      name: "Phase voltage L2"
      type: sensor
      unit_of_measurement: "V"
      device_class: voltage
      accuracy_decimals: 1
      state_class: measurement
    - code: "1-0:72.7.0"
      name: "Phase voltage L3"
      type: sensor
      unit_of_measurement: "V"
      device_class: voltage
      accuracy_decimals: 1
      state_class: measurement
    - code: "1-0:31.7.0"
      name: "Phase current L1"
      type: sensor
      unit_of_measurement: "A"
      device_class: current
      accuracy_decimals: 2
      state_class: measurement
    - code: "1-0:51.7.0"
      name: "Phase current L2"
      type: sensor
      unit_of_measurement: "A"
      device_class: current
      accuracy_decimals: 2
      state_class: measurement
    - code: "1-0:71.7.0"
      name: "Phase current L3"
      type: sensor
      unit_of_measurement: "A"
      device_class: current
      accuracy_decimals: 2
      state_class: measurement

    # --- Other info ---
    - code: "0-0:96.7.21"
      name: "Electricity failures"
      type: sensor
      icon: mdi:alert
      accuracy_decimals: 0
    - code: "0-0:96.7.19"
      name: "Long electricity failures"
      type: sensor
      icon: mdi:alert-outline
      accuracy_decimals: 0
    - code: "0-0:1.0.0"
      name: "Date and time stamp"
      type: text_sensor
      icon: mdi:clock-time-eight

# --- Recommended Text Sensors for Debugging ---
text_sensor:
  - platform: dsmr_custom
    dsmr_custom_hub_id: dsmr_hub
    
    # This sensor is highly recommended to identify your meter
    identification:
      name: "P1 Telegram Header"
      icon: mdi:barcode-scan
      
    # Use this sensor to see ALL data from your meter to find OBIS codes
    telegram:
      name: "DSMR Full Telegram"
      internal: false # IMPORTANT: Set to false to see this sensor in Home Assistant
      icon: mdi:text-box-search-outline

Please try it out and provide your feedback - happy metering!

Quickfix v1.0.2
Need to rewrite a bit of quickstart as I could not get esp->homeassistant telegram sending to work reliably. Simpler quickstart now just guides one to read manually logs from device.

And there was a little debug-log writing bug which crashed the build if was debugging. Now it should work as intended.

Happy metering!

Very interested, as I’m running into limitations with my Belgian DSMR meter.

However, two issues:
your telegram is missing an id: or name: in your example dumping config.

Second, worse, on ESPhome 2024.2.2, I get:

Compiling .pioenvs/dsmr-meter/src/esphome/components/dsmr_custom/fields.cpp.o
In file included from src/esphome/components/dsmr_custom/dsmr.cpp:36:
src/esphome/components/dsmr_custom/dsmr.h:42:14: fatal error: esphome/components/sensor/sensor.h: No such file or directory
     #include "esphome/components/sensor/sensor.h"
              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

I can try upgrading, do you expect a minimum version ?
Same problem on ESPHome 2025.6.3

@Xoliul, thank you for checking out the component. Just to clarify are you using the encrypted data in your meter?

No encrypted data.

OK, if you do have unencrypted data, let’s start debugging why you do not see data flowing from UART. 1st, did your last working version with original dsmr provided you working sensors in the HASS?

If yes, do you have same UART configuration on both original dsmr and dsmr-custom?

Uart config is like mine, but is your spesific ESP board config, below is my config for my D1 board:

uart:
  id: uart_bus
  baud_rate: 115200
  rx_pin: D7
  rx_buffer_size: 1700 

I don’t think I can even compile to debug, as I get a compilation error on sensor.h.
I’m no expert, but it seems something is wrong in your code that causes this?

@Xoliul, before going too deep into the huge code base of the component and if it is working or not in the general sense, can you please provide a bit more information of your situation as I asked in my previous post?

Hello @nikop

First of all I would like to thank you for this great feature :+1:
I’m from Luxembourg (the data meter is encrypted) and I tried to deploy your code but I encountered exactly the same error like @Xoliul

  1. First error (easy to fix) is “At least one of ‘id:’ or ‘name:’ is required!.”
    To fix it I added a name to the statement
    telegram:
      name: "Full Telegram"
      internal: true # This prevents the state from being sent to Home Assistant
      on_value:
        - logger.log:
            level: INFO
            tag: "telegram_dump" # Makes the message easy to find in logs
            format: "--- FULL TELEGRAM RECEIVED ---\n%s\n-----------------------------"
            args: [x.c_str()]
  1. The second error is

    I don’t know if the cause is that I’m running Home Assistant on virtual box VM. I hope that you can help me on that. Thanks

I’m joining the yaml config that I used:

esphome:
  name: dsmr-diagnostics

esp32:
  board: nodemcu-32s
  framework:
    type: arduino

wifi:
  ssid: "ssid"
  password: "Password"
  use_address: 192.168.178.97

api:
  encryption:
    key: "The api KEy"

ota:
  - platform: esphome
    password: "ota password"

# The logger is essential for viewing the telegram data
logger:
  level: INFO # INFO level is sufficient for this purpose

uart:
  id: uart_bus
  baud_rate: 115200
  rx_pin:
    number: GPIO18
    inverted: true
  rx_buffer_size: 1700

web_server:
  port: 80

external_components:
  - source:
      type: git
      url: https://github.com/nikopaulanne/dsmr-custom
      ref: 1.0.2
    components: [ dsmr_custom ]

# --- DSMR Hub ---
dsmr_custom:
  id: dsmr_hub
  uart_id: uart_bus

# --- Sensors for Logging & Diagnostics Only ---
text_sensor:
  - platform: dsmr_custom
    dsmr_custom_hub_id: dsmr_hub
    
    # This sensor helps confirm a connection to the meter
    identification:
      name: "P1 Telegram Header"
      
    # This captures the full telegram but does NOT send it to a Home Assistant state.
    # Instead, a lightweight on_value trigger prints the data to the logs.
    telegram:
      name: "Full Telegram"
      internal: true # This prevents the state from being sent to Home Assistant
      on_value:
        - logger.log:
            level: INFO
            tag: "telegram_dump" # Makes the message easy to find in logs
            format: "--- FULL TELEGRAM RECEIVED ---\n%s\n-----------------------------"
            args: [x.c_str()]

Hi @Khaledd — thank you for testing this and for sharing your config :pray:

I just noticed my GitHub README accidentally showed ref: 1.0.2 (missing the leading v). Sorry for the confusion! The correct tag is v1.0.2 (as in the forum examples). (GitHub)

Could you try these two quick steps:

  1. Clean the build cache in ESPHome (device ⋮ → Clean Build Files) and then compile again. If it still misbehaves, a one-time ESPHome add-on reinstall usually clears stubborn cache issues. (GitHub)
  2. In your YAML, change only the tag line to the exact value below and re-compile:
external_components:
  - source:
      type: git
      url: https://github.com/nikopaulanne/dsmr-custom
      ref: v1.0.2   # ← correct tag (with the leading 'v')
    components: [ dsmr_custom ]

Everything else in your config can stay as you have it (including the telegram: name: "Full Telegram" you added). If the build still fails after the clean + tag fix, please share:

  • Your ESPHome version and install type (HA add-on / Docker / standalone)
  • The first ~30–40 lines of the build log (where include paths are shown)

Happy to help you get this running — thanks again and sorry for the hiccup! :raised_hands:

Hi nikop,

thanks a lot for sharing your component. Im currently trying to build it, but not yet with sucess. The error message I get is the following:

INFO ESPHome 2025.11.2
INFO Reading configuration /config/esphome/p1-interf-allg.yaml...
INFO Generating C++ source...
INFO Setting CONFIG_LWIP_MAX_SOCKETS to 14 (registered: api=4, captive_portal=4, mdns=2, ota=1, web_server=3)
INFO Compiling app... Build path: /data/build/p1-interf
Processing p1-interf (board: esp32dev; framework: arduino, espidf; platform: https://github.com/pioarduino/platform-espressif32/releases/download/55.03.31-2/platform-espressif32.zip)
--------------------------------------------------------------------------------
INFO Package configuration completed successfully
INFO Package configuration completed successfully
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
 - contrib-piohome @ 3.4.4 
 - framework-arduinoespressif32 @ 3.3.2 
 - framework-arduinoespressif32-libs @ 5.5.0+sha.129cd0d247 
 - framework-espidf @ 3.50501.0 (5.5.1) 
 - tool-cmake @ 4.0.3 
 - tool-esp-rom-elfs @ 2024.10.11 
 - tool-esptoolpy @ 5.1.0 
 - tool-mklittlefs @ 3.2.0 
 - tool-ninja @ 1.13.1 
 - tool-scons @ 4.40801.0 (4.8.1) 
 - toolchain-xtensa-esp-elf @ 14.2.0+20241119
Reading CMake configuration...
Dependency Graph
|-- Networking @ 3.3.2
|-- ESP32 Async UDP @ 3.3.2
|-- DNSServer @ 3.3.2
|-- WiFi @ 3.3.2
|-- ESPmDNS @ 3.3.2
|-- Update @ 3.3.2
|-- ArduinoJson @ 7.4.2
|-- Crypto @ 0.4.0
Compiling .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o
Compiling .pioenvs/p1-interf/src/esphome/components/esp32/core.cpp.o
In file included from src/esphome/components/dsmr_custom/dsmr.cpp:36:
src/esphome/components/dsmr_custom/dsmr.h:42:14: fatal error: esphome/components/sensor/sensor.h: No such file or directory
   42 |     #include "esphome/components/sensor/sensor.h"
      |              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
*** [.pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o] Error 1

My configuration is as below. I also had to add a name to the telegram sensor:

uart:
  id: P1_UART
  baud_rate: 115200
  rx_pin: GPIO16
  rx_buffer_size: 1700

external_components:
  - source:
      type: git
      url: https://github.com/nikopaulanne/dsmr-custom
      ref: v1.0.2 # Or the latest version tag
    components: [ dsmr_custom ]

dsmr_custom:
  id: dsmr_hub
  uart_id: P1_UART

# --- Sensors for Logging & Diagnostics Only ---
text_sensor:
  - platform: dsmr_custom
    dsmr_custom_hub_id: dsmr_hub
    
    # This sensor helps confirm a connection to the meter
    identification:
      name: "P1 Telegram Header"
      
    # This captures the full telegram but does NOT send it to a Home Assistant state.
    # Instead, a lightweight on_value trigger prints the data to the logs.
    telegram:
      name: "Full Telegram"
      internal: true # This prevents the state from being sent to Home Assistant
      on_value:
        - logger.log:
            level: INFO
            tag: "telegram_dump" # Makes the message easy to find in logs
            format: "--- FULL TELEGRAM RECEIVED ---\n%s\n-----------------------------"
            args: [x.c_str()]

I’m using HomeassistantOS with the ESPHome Builder addon.

Any ideas, why the sensor.h cannot be found?

1 Like

Hi there!

I can see what’s causing your compilation error. Error needs to be fixed also in the component code. The quick fix for you is simple:

Quick Solution

Add any sensor platform to your YAML configuration. For example:

sensor:
  - platform: uptime
    name: "Uptime"
    id: slimmelezer_uptime_sensor

# ... rest of your configuration

This should resolve the sensor.h: No such file or directory error immediately.


Why This Happens (Detailed Explanation)

Your configuration currently only includes text_sensor: definitions but no sensor: platforms. Here’s what’s happening behind the scenes:

ESPHome’s Build Logic

  1. Component Selection: ESPHome analyzes your YAML and only includes components you explicitly use
  2. Missing Sensor Component: Without any sensor: platform defined, ESPHome doesn’t include the sensor component in the build
  3. Header File Missing: When dsmr_custom tries to compile and include esphome/components/sensor/sensor.h, the file doesn’t exist in the build directory
  4. Compilation Fails: Result is the error you’re seeing

Why This Is a Component Issue

The dsmr_custom component’s C++ code (specifically dsmr.h line 42) always includes:


#include "esphome/components/sensor/sensor.h"

However, the component’s __init__.py doesn’t force ESPHome to load the sensor component automatically. This is a design issue that will be addressed in future versions.

Your Working Configuration

Once you add any sensor platform (like uptime, wifi_signal, or any other), ESPHome will:

  • Include the sensor component in the build
  • Make sensor.h available for dsmr_custom to include
  • Compile successfully

The sensor you add doesn’t need to be related to DSMR - it just needs to trigger ESPHome to include the sensor component infrastructure.

Hope this helps! Let me know if you run into any other issues.

1 Like

Thanks for your help. You were exactly right. It’s kind of obvious and was bad luck that I had not (yet) any other sensors. Adding a sensor did the trick. Unfortunatly I’m still not through, the build process takes a very long time only to fail again at the end when linking firmware.elf. Maybe you also have an idea what the problem here could be:

The last lines of the build:

Linking .pioenvs/p1-interf/bootloader.elf
Building .pioenvs/p1-interf/bootloader.bin
Creating ESP32 image...
Successfully created ESP32 image.
Generating partitions .pioenvs/p1-interf/partitions.bin
Linking .pioenvs/p1-interf/firmware.elf
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o:(.literal._ZN7esphome11dsmr_custom4Dsmr11dump_configEv+0x5c): undefined reference to `_ZN7esphome11text_sensor15log_text_sensorEPKcS2_S2_PNS0_10TextSensorE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o:(.literal._ZN7esphome11dsmr_custom4Dsmr15publish_sensorsERN4dsmr10ParsedDataIJNS2_6fields14identificationEEEE+0x4): undefined reference to `_ZN7esphome11text_sensor10TextSensor13publish_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o: in function `_ZN7esphome11dsmr_custom4Dsmr11dump_configEv':
/data/build/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp:649:(.text._ZN7esphome11dsmr_custom4Dsmr11dump_configEv+0xc1): undefined reference to `_ZN7esphome11text_sensor15log_text_sensorEPKcS2_S2_PNS0_10TextSensorE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: /data/build/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp:657:(.text._ZN7esphome11dsmr_custom4Dsmr11dump_configEv+0xd2): undefined reference to `_ZN7esphome11text_sensor15log_text_sensorEPKcS2_S2_PNS0_10TextSensorE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o: in function `_ZN7esphome11dsmr_custom4Dsmr15publish_sensorsERN4dsmr10ParsedDataIJNS2_6fields14identificationEEEE':
/data/build/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp:624:(.text._ZN7esphome11dsmr_custom4Dsmr15publish_sensorsERN4dsmr10ParsedDataIJNS2_6fields14identificationEEEE+0x22): undefined reference to `_ZN7esphome11text_sensor10TextSensor13publish_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o: in function `_ZN7esphome11dsmr_custom4Dsmr31process_line_for_custom_sensorsEPKcj':
/data/build/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp:516:(.text._ZN7esphome11dsmr_custom4Dsmr31process_line_for_custom_sensorsEPKcj+0x1b1): undefined reference to `_ZN7esphome11text_sensor10TextSensor13publish_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp.o: in function `_ZN7esphome11dsmr_custom4Dsmr14parse_telegramEv':
/data/build/p1-interf/src/esphome/components/dsmr_custom/dsmr.cpp:597:(.text._ZN7esphome11dsmr_custom4Dsmr14parse_telegramEv+0x20b): undefined reference to `_ZN7esphome11text_sensor10TextSensor13publish_stateERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/main.cpp.o:(.literal._Z5setupv+0x160): undefined reference to `_ZN7esphome11text_sensor10TextSensor21add_on_state_callbackESt8functionIFvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE'
/data/cache/platformio/packages/toolchain-xtensa-esp-elf/bin/../lib/gcc/xtensa-esp-elf/14.2.0/../../../../xtensa-esp-elf/bin/ld: .pioenvs/p1-interf/src/main.cpp.o: in function `_ZN7esphome11Application18register_componentINS_11dsmr_custom4DsmrEEEPT_S5_':
/data/build/p1-interf/src/esphome/core/application.h:228:(.text._Z5setupv+0x5a0): undefined reference to `_ZN7esphome11text_sensor10TextSensor21add_on_state_callbackESt8functionIFvNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEEE'
collect2: error: ld returned 1 exit status
*** [.pioenvs/p1-interf/firmware.elf] Error 1
========================= [FAILED] Took 743.85 seconds =========================

Linking errors are often solved with “clean build” and then compile again.
Get the vacuum and mop out, it will take a looong time to build the first time.

1 Like

:tada: v1.2.0 Released – ESP-IDF Encryption Support!

I’m excited to announce v1.2.0 of dsmr-custom with a major new feature:

What’s New

  • :white_check_mark: Full ESP-IDF support with AES-GCM encryption (ESP32-C6, ESP32-H2, etc.)
  • :zap: Hardware-accelerated crypto – 10x faster on supported chips
  • :lock: Encrypted telegrams now work on both Arduino and ESP-IDF platforms

Status

  • Arduino (ESP8266/ESP32): Tested and working on D1 Mini with v1.2.0
  • ESP-IDF (ESP32-C6/H2): Compile-tested successfully, but needs field testing with real encrypted meters

Installation

Update your YAML to use the new version:

external_components:
  - source:
      type: git
      url: https://github.com/nikopaulanne/dsmr-custom
      ref: v1.2.0
    components: [ dsmr_custom ]

Community Testing Needed!

If you have:

  • ESP32-C6 or ESP32-H2 hardware
  • A meter with encrypted telegrams (Luxembourg, etc.)

Please test and report your results! Success or failure, your feedback helps everyone.

:package: Full release notes & technical details

Thank you to everyone who contributed feedback and testing! :pray:

I think you @Xoliul got same error as others in the 1.0.2, you needed to have at least one sensor configured in the esphome yaml -code. The new version 1.2.0 should work with only text-sensors.

Hope you can check the new 1.2.0 component version out and have happy times metering!

Thanks for the new release and also thanks to JeeCee for the hint to clean the files. I could succesfully build the new release after doing the clean up.
I don’t receive any data yet, but I think that’s a hardware bug. What I see when debugging directly on UART looks like “rubish”…

I can also confirm, that the component in the version 1.2.0.0 can be build with a text sensor only.