[dsmr] Remove dependency on Arduino framework. Various bug fixes. Add missing sensors. - #11036
Conversation
|
To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file: external_components:
- source: github://pr#11036
components: [dsmr]
refresh: 1h(Added by the PR bot) |
There was a problem hiding this comment.
Pull Request Overview
This pull request removes the Arduino framework dependency from the DSMR component and switches to a new parser library to fix various bugs. The changes replace the existing arduino-dsmr library with arduino-dsmr-2 and its associated crypto library, while updating namespace references and removing Arduino-specific conditional compilation guards.
Key changes:
- Switch from
arduino-dsmrtoarduino-dsmr-2parser library - Remove Arduino framework dependency and related conditional compilation
- Update namespace references from
::dsmr::fieldstoarduino_dsmr_2::fields
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| esphome/components/dsmr/dsmr.h | Updates include paths, namespace references, and removes Arduino conditional compilation |
| esphome/components/dsmr/dsmr.cpp | Updates parser namespace and removes Arduino conditional compilation |
| esphome/components/dsmr/init.py | Replaces library dependencies and removes Arduino framework requirement |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #11036 +/- ##
==========================================
- Coverage 73.46% 73.43% -0.03%
==========================================
Files 53 53
Lines 11310 11310
Branches 1535 1535
==========================================
- Hits 8309 8306 -3
- Misses 2602 2604 +2
- Partials 399 400 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I'll try this weekend. Next week I'm in Oslo for work and week after in Belgium. I'll try as quickly as I can to test this. |
|
Great @PolarGoose ! Was waiting for someone to make these changes for a long time now 👍 I have it running now on version 2025.10.0 as an external component (on ESP-IDF framework).
|
|
Tried on 2025.9.3 and 2025.10.1 and both works! |
|
You have modified clang-tidy configuration but have not updated the hash. Please run |
|
clang-tidy is failing on zephyr |
Memory Impact AnalysisComponents:
📊 Component Memory Breakdown
🔍 Symbol-Level Changes (click to expand)Changed Symbols
New Symbols (top 15)
Removed Symbols (top 15)
This analysis runs automatically when components change. Memory usage is measured from a representative test configuration. |
|
So now we need a docs PR linked. Once the docs PR is linked, the bot will remove the needs-docs label. Also be sure to update the Arduino to ESP-IDF guide as well in the docs as it currently mentions there is no dsmr option for IDF which can now be removed |
|
@PolarGoose I have created a new home for the dmsr library in an org and glmnet kindly transferred his fork there. https://github.com/esphome-libs/arduino-dsmr Can you make a PR to that repo with your changes, and once merged there I will give you access to write to that repo. Jesse |
|
I have made a pull request to esphome-libs. |
|
@PolarGoose Tested on 2025.10.2, it works for me. |
|
Really looking forward to this - it's my last esphome board which depends on arduino. Nice work, @PolarGoose 🙏! |
|
Tested and works on an ESP8266 (esp12e) on ESPHOME 2025.11.0 with: Fixes an issue that new DSRM meters do not always send unit. |
|
Thank you for testing. Glad that this pull request is useful.
|
Just waiting on time to review. I have 400+ in my backlog right now
Yes please |
|
To clear the needs-tests label, add a test in tests/components/dsmr/ for idf |
|
|
||
| # Crypto | ||
| cg.add_library("rweather/Crypto", "0.4.0") | ||
| cg.add_library("polargoose/Crypto-no-arduino", "0.4.0") |
There was a problem hiding this comment.
jesserockz: Do you think we need to move this to esphome libs before merging?
There was a problem hiding this comment.
In my opinion, it is easier to remove the dependency on this library in the following pull request.
There was a problem hiding this comment.
By the way, @jesserockz previously said here:
Another PR is fine for this work.
|
The |
|
Not sure |
|
Try resolving the conflicts and see if it solves it |
|
The issue is still present. I think it is related to the file tests/components/dsmr/test.esp32-idf.yaml that I have added. I don't see anything wrong with it. However, it triggers the |
|
The impact analysis should be running |
This command works if I run it locally. However, the CI job fails :) |
|
I'll see if I can figure out why. Also would you please have a look at the conflicts again (sorry we merged some platformio fixes) |
|
So the reason its failing is its trying to build |
|
I'm testing a solution to allow merges without the need to force when target branch can't build #12381 |
|
Thanks, now it works. |
|
🎉 🎉 🎉 🎉 Thanks for the hard work @PolarGoose, @bdraco and the rest of the @esphomebot team! |
What does this implement/fix?
Introduce bare minimum changes in the DSMR component to:
The code uses arduino-dsmr-2 parser.
For more details on why this pull request was created, look at the discussion: Make the parser compile for Windows and Linux machines.
In short:
arduino-dsmrparser.Types of changes
Related issue or feature (if applicable):
Test Environment
Example entry for
config.yaml:I used the following config to test on my
ESP32-WROOM-32Dboard.Checklist:
tests/folder).If user exposed functionality or configuration variables are added/changed: