Repository navigation
Add an optional compare mask to UARTEx state_debounce - #380
Merged
Merged
Conversation
state_debounce now also accepts {delay, offset, mask}. Only the masked
bits are compared with the last applied state: when they are unchanged
the packet is applied immediately, so other values in the same packet
(e.g. current temperature) are not delayed. The plain time form keeps
comparing whole packets.
Refs #378
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Distinguish a mask entirely outside the payload from a partial overlap, skip the check when debounce is disabled, and cover it with unit tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #379 (refs #378).
state_debouncecan now compare only selected bits, so values that change often in the same packet (e.g. current temperature) are not delayed.Behaviour
delay, then the latest whole packet is applied; post-command bypass uses the same masked comparison.maskis required in the dict form;delay: 0swith a mask is ignored; max 60s;statestill required.offset + len(mask)exceeds every fixed-frame payload length.Tests
run.shpasses.tests/components/uartex/common.yamlnow validates both forms (climate2s, switch dict form);esphome config/compile --only-generatepass; negative schema checks rejected as expected.🤖 Generated with Claude Code