Skip to content

Extend list of patterns so that all dumps doesn't need custom patterns configured#8

Merged
PolarGoose merged 5 commits into
mainfrom
extend_list_of_default_patterns
May 3, 2026
Merged

Extend list of patterns so that all dumps doesn't need custom patterns configured#8
PolarGoose merged 5 commits into
mainfrom
extend_list_of_default_patterns

Conversation

@PolarGoose
Copy link
Copy Markdown
Collaborator

@PolarGoose PolarGoose commented May 3, 2026

I added all custom patterns that we encountered to the list of default patterns. Now the user has less need to specify custom patterns. Also, it should make usage from EspHome much easier for users.

Also, by doing that, I found that there were some values we missed in the dumps we have.

@PolarGoose PolarGoose requested review from Tomer27cz, Copilot and latonita and removed request for Copilot May 3, 2026 13:15
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR expands the built-in AXDR pattern set loaded by DlmsParser::load_default_patterns() so integration tests for various meter dumps no longer need per-test custom pattern registration, and updates expected fixtures to reflect the additional/default matches.

Changes:

  • Added multiple additional default AXDR patterns (OBIS/value variants, datetime variants, etc.) to DlmsParser::load_default_patterns().
  • Simplified tests/test_meter_dumps.cpp by removing per-test register_pattern(...) setup lambdas where defaults now cover the structures.
  • Updated several tests/expected/*.h fixtures (counts and expected values/strings) to match new default pattern behavior.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/test_meter_dumps.cpp Removes custom per-dump pattern registration now covered by defaults.
tests/expected/raw_energomera.h Updates expected count and adds one newly matched float entry.
tests/expected/mbus_netz_noe_p1.h Updates expected count and adds a DateTime string expectation.
tests/expected/hdlc_lgz_e450_2.h Updates expected count and adds a DateTime string expectation.
tests/expected/hdlc_kaifa_ma304h3e.h Reformats fixture and changes placeholder expectations to a real expected string/count.
src/dlms_parser/dlms_parser.cpp Extends the library’s default AXDR pattern registrations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/expected/hdlc_kaifa_ma304h3e.h Outdated
Comment thread tests/expected/hdlc_kaifa_ma304h3e.h Outdated
Comment thread src/dlms_parser/dlms_parser.cpp Outdated
Comment thread src/dlms_parser/dlms_parser.cpp Outdated
Comment thread src/dlms_parser/dlms_parser.cpp Outdated
Comment thread tests/expected/mbus_netz_noe_p1.h
Comment thread tests/expected/hdlc_lgz_e450_2.h Outdated
@PolarGoose PolarGoose force-pushed the extend_list_of_default_patterns branch 4 times, most recently from 40e4ab9 to c9ec694 Compare May 3, 2026 13:57
@PolarGoose PolarGoose requested a review from Copilot May 3, 2026 13:57
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/test_meter_dumps.cpp Outdated
Comment thread tests/expected/hdlc_lgz_e450_2.h Outdated
@PolarGoose PolarGoose force-pushed the extend_list_of_default_patterns branch from c9ec694 to ba6bfc8 Compare May 3, 2026 14:05
Copy link
Copy Markdown
Collaborator

@Tomer27cz Tomer27cz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. The usability gain outweighs the microscopic performance loss.

@PolarGoose
Copy link
Copy Markdown
Collaborator Author

@Tomer27cz,

Do you know why we need V and TV to describe the same generic value? Should we leave only V because it is more logical, it is not tagged, it is just a value.

@Tomer27cz
Copy link
Copy Markdown
Collaborator

Tomer27cz commented May 3, 2026

V and TV are aliases that both dynamically read an A-XDR type tag
V is not actually untagged.
They are just for visual consistency, so you can write symmetric patterns like TO, TV
I would keep it. No reason to remove it and break patterns.
You can merge this.

@Tomer27cz
Copy link
Copy Markdown
Collaborator

Tomer27cz commented May 3, 2026

Don't forget to update the idf_component version

@PolarGoose PolarGoose merged commit 9ce0cac into main May 3, 2026
7 checks passed
@PolarGoose PolarGoose deleted the extend_list_of_default_patterns branch May 3, 2026 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants