Avoid polling after segmented light commands#676
Open
aserper wants to merge 1 commit into
Open
Conversation
Segment light entities are optimistic, but the control path still scheduled the generic post-control Platform API poll. For segmented devices that poll returns a device-level color rather than per-segment state, so skip the follow-up poll for segment commands while preserving serialized device control.
Closed
4 tasks
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
Avoid scheduling the follow-up Platform API state poll after segmented light commands.
Segmented light entities are already configured as optimistic in Home Assistant. After a segment color/brightness command, the bridge currently schedules the same post-control poll used for whole-device commands. For segmented devices, that Platform API poll reports only a device-level light state, not per-segment state. Reconciling immediately against that simplified state can make Home Assistant and subsequent controls treat a single whole-device color as authoritative after segment updates.
This change keeps the existing per-device serialization for segment commands, but skips the post-control poll for those segment commands.
Why
Observed with a segmented Govee light device:
segmentedBrightness/segmentedColorRgbthrough the Platform API.DeviceState.color, not the per-segment layout.Sanitized log excerpt:
The important detail is that the segment commands succeed, but the immediate poll only reports a whole-device color state.
Change
Coordinator::new_without_pollconstructor.State::resolve_device_for_control_without_pollto keep the serialization lock without scheduling the delayed state poll.mqtt_light_segment_command.Whole-device commands still use the existing post-control polling behavior.
Validation
Locally passed: