Skip to content

Fix AttributeError in EEP parser for missing enum values#27

Merged
ChristopheHD merged 4 commits intomscfrom
fix-eep-parser-crash-342066479357758187
Jan 29, 2026
Merged

Fix AttributeError in EEP parser for missing enum values#27
ChristopheHD merged 4 commits intomscfrom
fix-eep-parser-crash-342066479357758187

Conversation

@ChristopheHD
Copy link
Owner

The EEP parser was crashing with an AttributeError when encountering an enum value that wasn't defined in the EEP.xml. This was especially problematic for the new MSC telegrams where some fields might have values not yet fully defined in the XML.

Changes:

  • Modified _get_enum in enocean/protocol/eep.py to handle value_desc is None.
  • Added fallback to str(raw_value) if description is missing.
  • Added a unit test test_unknown_enum to verify the fix and prevent regressions.

PR created automatically by Jules for task 342066479357758187 started by @ChristopheHD

mak-gitdev and others added 4 commits January 28, 2024 15:31
Add F6-02-03 Light Control - Application Style 1
Tested for over a year but never took the time to add it: now it's done.
When parsing an EnOcean packet, if an enum value or rangeitem is not found
in the EEP XML definition, the parser would raise an AttributeError because
it tried to call .get() on a None object.

This commit adds a robust check and a fallback to returning the raw value
as a string when the description is missing.

Added a regression test in enocean/protocol/tests/test_eep.py.

Co-authored-by: ChristopheHD <16214389+ChristopheHD@users.noreply.github.com>
@google-labs-jules
Copy link

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 21480673029

Details

  • 21 of 25 (84.0%) changed or added relevant lines in 4 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.9%) to 38.644%

Changes Missing Coverage Covered Lines Changed/Added Lines %
enocean/protocol/eep.py 0 2 0.0%
enocean/protocol/packet.py 0 2 0.0%
Files with Coverage Reduction New Missed Lines %
enocean/protocol/eep.py 1 0.0%
Totals Coverage Status
Change from base Build 20711672079: 0.9%
Covered Lines: 473
Relevant Lines: 1224

💛 - Coveralls

@ChristopheHD ChristopheHD changed the base branch from master to msc January 29, 2026 13:52
@ChristopheHD ChristopheHD merged commit 7039603 into msc Jan 29, 2026
7 checks passed
@ChristopheHD ChristopheHD deleted the fix-eep-parser-crash-342066479357758187 branch January 29, 2026 13:55
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.

4 participants