Skip to content

Fix logbook spam by including image domain in ALWAYS_CONTINUOUS_DOMAINS#169240

Merged
MartinHjelmare merged 4 commits into
home-assistant:devfrom
daily063:fix-issue-161039
Apr 29, 2026
Merged

Fix logbook spam by including image domain in ALWAYS_CONTINUOUS_DOMAINS#169240
MartinHjelmare merged 4 commits into
home-assistant:devfrom
daily063:fix-issue-161039

Conversation

@daily063
Copy link
Copy Markdown
Contributor

@daily063 daily063 commented Apr 27, 2026

Proposed change

This PR adds the image domain to ALWAYS_CONTINUOUS_DOMAINS to prevent excessive logbook entries from image entities that frequently update their state.

Fixes #161039

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to not work as expected)
  • Operational change (internal change only)
  • Code quality improvements to existing code or addition of tests
  • Add or update documentation
  • Addition or update of translations

Additional information

Problem

Roborock map image entities caused excessive Activity log entries during cleaning due to frequent state changes. Image entities use timestamps as state values and should be treated as continuous domains (like counter and proximity) to filter out redundant state change events.

Solution

  • Add image to ALWAYS_CONTINUOUS_DOMAINS in homeassistant/components/logbook/const.py
  • Update existing tests in test_websocket_api.py to include image domain in continuous domain test cases

Checklist

  • The code change is tested and works locally.
  • Local tests pass.
  • There is no proprietary code used in this PR.
  • The code has been formatted using Ruff (the equivalent of black).
  • The code has been formatted using ruff check.
  • Tests have been added or updated to verify that the new or broken code works.
  • Any new entities are documented in the Developer Documentation.
  • The changes have been communicated to users in the release notes.

Fixes home-assistant#161039 where Roborock map image entities caused excessive
Activity log entries during cleaning due to frequent state changes.

Image entities use timestamps as state values and should be treated
as continuous domains (like counter and proximity) to filter out
redundant state change events from the logbook.

Changes:
- Add 'image' to ALWAYS_CONTINUOUS_DOMAINS in const.py
- Update existing tests to include image domain
- Add new test file test_image_continuous.py with comprehensive tests

Co-authored-by: Claude Code <claude@anthropic.com>
Copilot AI review requested due to automatic review settings April 27, 2026 01:23
@daily063 daily063 requested a review from a team as a code owner April 27, 2026 01:23
Copy link
Copy Markdown
Contributor

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @5-bean-curd

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant
Copy link
Copy Markdown
Contributor

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@home-assistant
Copy link
Copy Markdown
Contributor

Hey there @home-assistant/core, mind taking a look at this pull request as it has been labeled with an integration (logbook) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of logbook can trigger bot actions by commenting:

  • @home-assistant close Closes the pull request.
  • @home-assistant mark-draft Mark the pull request as draft.
  • @home-assistant ready-for-review Remove the draft status from the pull request.
  • @home-assistant rename Awesome new title Renames the pull request.
  • @home-assistant reopen Reopen the pull request.
  • @home-assistant unassign logbook Removes the current integration label and assignees on the pull request, add the integration domain after the command.
  • @home-assistant update-branch Update the pull request branch with the base branch.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) to the pull request.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component, problem in config, problem in device, feature-request) on the pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Logbook’s “continuous domain” filtering so image entities are treated like other high-churn domains, reducing Activity/logbook noise from frequent image state updates (e.g., Roborock map timestamps).

Changes:

  • Add image to ALWAYS_CONTINUOUS_DOMAINS so Logbook filters image state changes consistently across live streams and recorder queries.
  • Extend existing websocket API tests to include image entities in “always filtered” scenarios.
  • Add a new targeted test module covering inclusion in ALWAYS_CONTINUOUS_DOMAINS and entity filtering behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
homeassistant/components/logbook/const.py Adds image to the hardcoded always-continuous domain set used by Logbook filtering.
tests/components/logbook/test_websocket_api.py Updates websocket stream/filtering tests to account for the new image continuous-domain behavior.
tests/components/logbook/test_image_continuous.py Adds focused tests asserting image domain filtering expectations.

Comment thread tests/components/logbook/test_image_continuous.py Outdated
Comment thread homeassistant/components/logbook/const.py Outdated
@daily063 daily063 marked this pull request as ready for review April 27, 2026 02:22
Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address the bot review comments too.

Comment thread tests/components/logbook/test_image_continuous.py Outdated
@home-assistant home-assistant Bot marked this pull request as draft April 27, 2026 10:34
@MartinHjelmare MartinHjelmare changed the title fix(logbook): add image domain to ALWAYS_CONTINUOUS_DOMAINS Fix logbook spam by including image domain in ALWAYS_CONTINUOUS_DOMAINS Apr 27, 2026
@MartinHjelmare MartinHjelmare mentioned this pull request Apr 27, 2026
6 tasks
- Update comment in const.py to mention image domain (Copilot suggestion)
- Remove separate test module per maintainer request
- Move image continuous domain tests to test_websocket_api.py
- Test via public websocket API instead of private _is_state_filtered helper

Fixes review comments from PR home-assistant#169240
Copy link
Copy Markdown
Contributor

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @5-bean-curd

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@daily063
Copy link
Copy Markdown
Contributor Author

@MartinHjelmare Thanks for the review! I've addressed all the review comments:

  1. Updated comment in const.py - Added image to the comment above ALWAYS_CONTINUOUS_DOMAINS
  2. Removed separate test file - Deleted test_image_continuous.py and moved tests to test_websocket_api.py
  3. Test via public API - Changed from testing private helper to testing the public websocket event_stream filtering behavior

All changes have been pushed. Please take another look when you have a chance!

Comment thread homeassistant/components/logbook/const.py Outdated
@MartinHjelmare
Copy link
Copy Markdown
Member

Please solve the CI issues.

- Restore trailing newline in const.py (MartinHjelmare's suggestion)
- Remove redundant test_image_entity_filtered_from_subscription (broken
  websocket timing logic; image filtering is already covered by the
  existing test_subscribe_all_entities_are_continuous and the
  parametrized test_consistent_stream_and_recorder_filtering)
- Remove trivial test_image_in_always_continuous_domains (the
  parametrized test already implicitly validates this)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 28, 2026 10:04
Copy link
Copy Markdown
Contributor

@home-assistant home-assistant Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @5-bean-curd

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/components/logbook/const.py
@daily063
Copy link
Copy Markdown
Contributor Author

Please address the bot review comments too.

Done — restored the trailing newline. Sorry about that.

@daily063
Copy link
Copy Markdown
Contributor Author

Please solve the CI issues.

@MartinHjelmare The only failing CI check is Run tests Python 3.14.2 (3), caused by a lingering task in tests/components/google_generative_ai_conversation/test_tts.py::test_tts_service_speak[service_data0] — unrelated to this PR. All logbook tests pass. Could you re-run the failing job?

@MartinHjelmare
Copy link
Copy Markdown
Member

Please press the Ready for review button when ready for review and merge.

@daily063 daily063 marked this pull request as ready for review April 29, 2026 08:47
Copilot AI review requested due to automatic review settings April 29, 2026 08:47
@home-assistant home-assistant Bot requested a review from MartinHjelmare April 29, 2026 08:47
@home-assistant home-assistant Bot dismissed stale reviews from themself April 29, 2026 08:47

Stale

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copy link
Copy Markdown
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MartinHjelmare MartinHjelmare merged commit bb41a2d into home-assistant:dev Apr 29, 2026
48 of 49 checks passed
@MartinHjelmare
Copy link
Copy Markdown
Member

@5-bean-curd I noticed now that you've changed the PR template to something that looks like an AI generated version influenced by our standard PR template. Please don't change the PR template in the future. Just fill it out appropriately.

@github-actions github-actions Bot locked and limited conversation to collaborators Apr 30, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Roborock integration spams Activity with frequent map update state changes during cleaning

3 participants