[dsmr] Add deprecated std::string overload for set_decryption_key#14180
[dsmr] Add deprecated std::string overload for set_decryption_key#14180
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#14180
components: [dsmr]
refresh: 1h(Added by the PR bot) |
|
👋 Hi there! This PR modifies 1 file(s) with codeowners. @glmnet, @PolarGoose, @zuidwijk - As codeowner(s) of the affected files, your review would be appreciated! 🙏 Note: Automatic review request may have failed, but you're still welcome to review. |
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. |
There was a problem hiding this comment.
Pull request overview
This PR adds a deprecated std::string overload for the set_decryption_key() method in the DSMR component to provide a graceful migration path for users who were broken by the API change in 2026.2.0 (PR #13375). The original change switched from const std::string & to const char * to avoid heap allocation, but broke existing lambda usage without a deprecation period.
Changes:
- Adds a deprecated inline
std::stringoverload that forwards to theconst char*version with a 6-month removal timeline (2026.8.0) - Adds test coverage to verify the deprecated overload compiles correctly in lambda contexts
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| esphome/components/dsmr/dsmr.h | Adds deprecated inline std::string overload with ESPDEPRECATED macro and clear migration message |
| tests/components/dsmr/common.yaml | Adds test case for deprecated overload in lambda context to ensure it compiles |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #14180 +/- ##
==========================================
- Coverage 74.11% 74.09% -0.03%
==========================================
Files 55 55
Lines 11591 11591
Branches 1578 1578
==========================================
- Hits 8591 8588 -3
- Misses 2598 2600 +2
- Partials 402 403 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
I already asked this question in the previous pull request when the Are you sure you don't want to use |
|
Thanks for the suggestion! We intentionally avoid That said, as a codeowner of this component, if you'd like to keep the |
Ok. Agreed. |
|
thanks |
What does this implement/fix?
Adds a deprecated
std::stringoverload forset_decryption_key()to ease the transition for users who were calling this method from lambdas with astd::stringargument.The
const char *signature was introduced in #13375 to avoid heap allocation. Whileset_decryption_key()is not documented at esphome.io and therefore not public API per our policy, adding this overload gives users a deprecation warning with a clear migration path instead of a hard compile error.The overload will be removed in 2026.8.0.
Types of changes
Related issue or feature (if applicable):
Pull request in esphome-docs with documentation (if applicable):
Test Environment
Example entry for
config.yaml:Checklist:
tests/folder).If user exposed functionality or configuration variables are added/changed: