ESPHome support

ESPHome support was already there for DSMR. On GitHub there is a repository from nldroid which works absolutely fine! I even posted about this a while ago: ESPHome powered P1 meter. Yet this only worked for most of the readers, not all. Some countries like Belgium, Luxembourg, Sweden, and probably some other countries had some other fields in use than the standard.

For example Luxembourg is using encryption on their P1 port. So the data has to be decrypt before it is readable. Some other countries does also use KVar, which we in Holland don’t use. I wanted DSMR to be available for everybody in every country who’s using meters based on DSMR. So I started to look into the code and tried to rewrite some code, add more libraries, and boy did I found out that I’m not that good in coding…

I eventually asked a code dev-er from ESPHome. First Jesse, who gave me the first examples for custom_component, which I still struggled with. Later Guillermo who helped me a lot with rewriting more code. He eventually wrote the whole code as it is today. Off course I paid for his help, as he put a lot of time in to it.

Decryption support for Luxembourg

We found some good usable decryption examples, and as most Home Assistant users in Luxembourg knows: the decryption wasn’t handled that good. Not in the readers, not in the Home Assistant dsmr component. Obviously the question is: where should the decryption be handled?

To skip that question, I’ve decided to try to get that support straight into (my) reader. And luckily Guillermo managed to pull that off. If there’s a decryption key set, the reader will try to decrypt the telegrams with that key. If it isn’t set, it won’t decrypt.

There are two ways to set the key, either in the code, or via Home Assistant. Via the code it’s just one extra line under dsmr: ‘decryption_key’:

  id: dsmr_instance
  decryption_key: '00112233445566778899AABBCCDDEEFF'

Via Home Assistant you can use the service which is in the code via an API: <node_name>_set_dsmr_key

The code on GitHub

As I want it to be available for everybody, I’ve put the code on GitHub:

Just use the example code “slimmelezer.yaml” and all the available fields will be added to Home Assistant.


  1. Bob van Mierlo

    Hi Marcel,

    Ik heb je P1 wifi reader gekocht toen je deze nog standaard met esp-link leverde. Ik probeer deze nu te flashen naar esphome, maar de D1 mini pro wil onmogelijk in flashmodus gaan. Met geen enkele applicatie of usbkabel wil hij een nieuwe firmware accepteren.

    Heb ESPHome geprobeerd vanaf m’n latop, maar ook vanaf de Home Assistant server. Geen succes.
    Ook de ESPHome flasher voor windows werkt in 64bit en 32bit versie niet.

    Heb je nog ideeën?

Leave a Reply

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