Skip to content

Avoid redundant state writes on coordinator updates#241

Merged
MTrab merged 1 commit intomainfrom
fix/reduce-redundant-state-writes
Mar 11, 2026
Merged

Avoid redundant state writes on coordinator updates#241
MTrab merged 1 commit intomainfrom
fix/reduce-redundant-state-writes

Conversation

@MTrab
Copy link
Copy Markdown
Owner

@MTrab MTrab commented Mar 11, 2026

Summary

  • avoid calling async_write_ha_state() for sensors, binary sensors, and switches when coordinator data does not change entity state
  • keep entity attributes untouched when the computed state is unchanged
  • add targeted regression tests covering unchanged and changed update paths

Test strategy

  • ruff check .
  • python -m pytest -q tests

Known limitations

  • this only removes redundant writes for the entity types covered here; other platforms are unchanged
  • no hardware validation was performed; coverage is based on unit tests only

Configuration changes

  • none

@github-actions github-actions Bot added the bug Something isn't working label Mar 11, 2026
@MTrab MTrab added the patch Patch version release label Mar 11, 2026
@MTrab MTrab merged commit 2c0b180 into main Mar 11, 2026
4 checks passed
@MTrab MTrab deleted the fix/reduce-redundant-state-writes branch March 11, 2026 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working patch Patch version release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant