Skip to content

Refactor code structure for improved readability and maintainability#13

Merged
azebro merged 1 commit into
mainfrom
dev
Mar 7, 2026
Merged

Refactor code structure for improved readability and maintainability#13
azebro merged 1 commit into
mainfrom
dev

Conversation

@azebro
Copy link
Copy Markdown
Owner

@azebro azebro commented Mar 7, 2026

This pull request improves support for H-firmware TAPs in the parser by relaxing validation of the status_type bits in RECEIVE_RESPONSE frames, updating documentation to clarify the bitmask meaning, and adding new tests to ensure compatibility with both G-firmware and H-firmware. It also refines the coordinator save scheduling logic to use a throttle pattern for more robust state persistence.

Parser and protocol improvements:

  • Updated the _handle_receive_response method in parser.py to no longer validate bits 5-7 of status_type, allowing H-firmware frames (with bits 5-7 cleared) to be parsed correctly. Only bits 0-4 are now used to determine optional fields.
  • Added comprehensive tests in test_parser.py to verify that RECEIVE_RESPONSE parsing works for both H-firmware (bits 5-7 cleared) and G-firmware (bits 5-7 set), including power report extraction and handling of empty responses.

Documentation updates:

  • Revised implementation_plan.md to clarify that bits 5-7 of status_type are firmware-dependent flags with no effect on payload structure, and removed the requirement to validate these bits. [1] [2]

Coordinator state persistence:

  • Changed the _schedule_save logic in coordinator.py to use a throttle pattern instead of debounce, ensuring that state saves are not repeatedly rescheduled under rapid updates and are always persisted within the expected delay window.

@azebro azebro merged commit 0f64d60 into main Mar 7, 2026
6 of 8 checks passed
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.

1 participant