Skip to content

Add a system log subscription to the event stream - #408

Open
ptr727 wants to merge 3 commits into
loopj:mainfrom
ptr727:system-log
Open

ptr727 wants to merge 3 commits into
loopj:mainfrom
ptr727:system-log

Conversation

@ptr727

@ptr727 ptr727 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Stacked on #407, which is stacked on #406. This branch carries both of their commits too. Only the last commit, "Add a system log subscription to the event stream", is new here.

Why

InFusion Diagnostics' Log view shows the controller's warnings and module offline/online messages. The IDiagnostic PR adds reading that log. This adds the live version, from the Host Command SYSTEM enhanced log, so an integration can alert when a module goes offline as it happens.

This is the third of three PRs split from #404, as asked.

How it is implemented

  • EventStream.subscribe_system_log subscribes to the SYSTEM enhanced log and passes each system log line to the callback as a SystemLogReceived, with its type, source and message. log_type names the type with SysLogType. It is built on subscribe_enhanced_log, so peers, reference counting and resubscribing after a reconnect work as they already do.
  • Enhanced log lines carry no type tag, so the parser matches only the system log shape: a type number, a one-word source and a message. A trigger line (five integers) and an object status line (a VID followed by Interface.Method) don't match. The controllers' enhanced log handler already skips non-status lines, from the trigger log PR.
  • Example: examples/command_client/monitor_system_log.py.

Protocol notes

Verified against an IC-II controller on 4.11 firmware:

  • SYSTEM lines are <type> <source> <message>, where the source is one word, eg. Controller.
  • A module losing a line feed logs a warning plus Module Offline and Module Online.
  • Subscribing turns on ELENABLE SYSTEM ON, which stays on after the client disconnects, the same as the existing enhanced log subscriptions.

How it was tested

  • New tests:
    • system log parsing, including extra whitespace, truncated lines with no message, and lines of the other shapes;
    • subscribing, which enables the SYSTEM log.
  • pytest, ruff check, ruff format --check and pyright pass.
  • Run against a live controller, including a deliberate breaker trip on one module, which showed up as the warning and the offline/online pair above.

Home Assistant

A companion change to home-assistant-vantage fires a vantage_system_log event from this subscription, and refreshes the module connectivity sensors on offline/online messages. It will follow once an aiovantage release carrying these changes is available to pin.

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 22, 2026 12:26
Add DiagnosticInterface for the read-only IDiagnostic methods InFusion
Diagnostics uses for its History and Log views: the trigger history, the
system log, and the modules answering on an enclosure's bus. TriggerType
and SysLogType name the trigger and log type codes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add EventStream.subscribe_triggers for the live EVENT enhanced log, which
names the object that started each task, and have the controllers'
enhanced log handler skip lines that are not object status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Add EventStream.subscribe_system_log for the live SYSTEM enhanced log,
which carries the controller's warnings and module offline and online
messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Approval recommended

The reviewed changes have no unresolved blocking issues.

No open issues 🎉

What changed in this PR

Adds diagnostic data access and live enhanced-log subscriptions for trigger and system events, including system-log notifications such as module offline/online messages.

Changes:

  • Adds diagnostic RPC models and interfaces for event history, system logs, and module status.
  • Adds trigger and system-log parsing and subscriptions with reconnect and reference-count support.
  • Filters non-status enhanced-log entries from controller handling.
  • Adds tests and monitoring examples.
File Description
tests/​controllers/​test_base.py Verifies non-status enhanced-log entries are ignored while object status updates continue working.
tests/​config_client/​test_diagnostic.py Tests diagnostic RPC parsing, addressing, empty results, and unreadable fields.
tests/​command_client/​test_events.py Tests trigger/system-log parsing, subscriptions, and reference-count behavior.
src/​aiovantage/​events.py Defines and parses trigger and system-log event payloads.
src/​aiovantage/​config_client.py Exports diagnostic interfaces, models, and log-type enums.
src/​aiovantage/​_log_types.py Defines trigger and system-log type enums.
src/​aiovantage/​_controllers/​base.py Filters non-object-status entries from enhanced-log handling.
src/​aiovantage/​_config_client/​interfaces/​diagnostic.py Implements diagnostic XML models and RPC interface methods.
src/​aiovantage/​_command_client/​events.py Adds live trigger and system-log subscription APIs.
examples/​config_client/​dump_diagnostics.py Demonstrates reading diagnostic history, logs, and module status.
examples/​command_client/​monitor_triggers.py Demonstrates live trigger monitoring.
examples/​command_client/​monitor_system_log.py Demonstrates live system-log monitoring.

Review effort: Lite

This branch has not been deployed

No deployments
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.

2 participants