Stream continuous-sensor changes to the live activity log - #51
Merged
Conversation
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
LogbookController.handle_state_change(src/hatty/controllers/logbook.py) no longerunconditionally suppresses the
state_changedfallback while alogbook/event_streamsubscription is active — it now exempts "continuous" sensors (
is_continuous_sensor, theissue Activity log shows no history for numeric sensors #29 predicate), since HA's live stream excludes them from its own logbook just like
logbook/get_eventsdoes. A regular entity (light, lock, binary_sensor, …) is still onlyever appended by the stream, so no double-logging.
old_stateis available (continuous sensors firestate_changedon attribute-only updates too), and renders the entity's unit so a livetemperature line matches the fetched path's
21.5 °Cinstead of a bare21.5.ConnectionController._handle_event_messagenow forwardsold_statethrough tolog_ctl.handle_state_change.Fixes #50.
Test plan
uv run pytest tests/unit/test_logbook_controller.py tests/test_activity_log.py tests/test_dashboard_activity_log.py tests/unit/test_connection_controller.py tests/unit/test_notifications.pyuv run ruff check .uv run pyrightuv run pytest(full suite, 1310 passed)