Skip to content

Stream continuous-sensor changes to the live activity log - #51

Merged
iTerminate merged 1 commit into
mainfrom
fix-live-log-continuous-sensors
Aug 14, 2026
Merged

Stream continuous-sensor changes to the live activity log#51
iTerminate merged 1 commit into
mainfrom
fix-live-log-continuous-sensors

Conversation

@iTerminate

Copy link
Copy Markdown
Owner

Summary

  • LogbookController.handle_state_change (src/hatty/controllers/logbook.py) no longer
    unconditionally suppresses the state_changed fallback while a logbook/event_stream
    subscription is active — it now exempts "continuous" sensors (is_continuous_sensor, the
    issue 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_events does. A regular entity (light, lock, binary_sensor, …) is still only
    ever appended by the stream, so no double-logging.
  • Also drops a no-op change when old_state is available (continuous sensors fire
    state_changed on attribute-only updates too), and renders the entity's unit so a live
    temperature line matches the fetched path's 21.5 °C instead of a bare 21.5.
  • ConnectionController._handle_event_message now forwards old_state through to
    log_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.py
  • uv run ruff check .
  • uv run pyright
  • uv run pytest (full suite, 1310 passed)

@iTerminate
iTerminate merged commit 532f2e2 into main Aug 14, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Activity log doesn't stream continuous-sensor updates live

1 participant