Repository navigation
Conversation
…or watched entities Ports the deliver/session-mode feature to the standalone plugin. Two closed core PRs carried this work and are embedded here: #96930 (configurable deliver target for watch_entities/watch_domains, DavidMetcalfe) and #112136 (session-mode delivery integrated on top, with silent-session markers and identifier hardening). Both were closed as no-longer-applicable when Home Assistant left hermes-agent core in #132469 and the bundled adapter moved to this standalone plugin (the plugin's adapter predates both). - deliver: per-entity/domain cross-platform target override (tag grammar ha_events:<platform>[;session]); default target configurable - deliver_mode: broadcast (default) or session — session injects the EVENT into the target chat's session via admit_internal_event (one agent turn inside that chat's history) instead of broadcast-shipping the reply - never-mint invariant: derived keys must match an existing session (lookup, never get_or_create); unresolvable chat shapes fail closed - chat-type resolution: persisted chat_type -> platform chat-id formats -> None (fail closed) - injection budget: per-CHAT rolling-window cap, slot spent only on admission - canonical silence-marker strip + untrusted-data framing on injected payloads - fail-safe broadcast routing: private core APIs used only inside guarded blocks; any incompatibility degrades to the HA notification - backport #71206 (_connect_error_detail) + NOTIFICATION_TITLE from the plugin extraction - tests/test_homeassistant_adapter_ported.py: the full adapter suite (82 tests) ported to the plugin layout (homeassistant_plugin imports); mutation-verified: never-mint, budget, and marker-strip mutations each flip specific tests to failed - README documents deliver/deliver_mode and the dict-form watch entries Co-authored-by: DavidMetcalfe <80915+DavidMetcalfe@users.noreply.github.com>
The ported suite asserts PlatformConfig.token == "env-token", but that credential propagation row left core with the Home Assistant extraction (NousResearch/hermes-agent#132469). The plugin's adapter reads the token from the environment itself, so assert it at the layer that owns it now. Platform and extra["url"] assertions are unchanged. No production code changes.
This was referenced Oct 24, 2026
Contributor
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.
Supersedes #5 (and #194, which carried the CI fix aimed at #5's branch).
Why a new PR
#5's head branch
port/homeassistant-2was cut on Oct 10, and its.github/workflows/tests.ymlpredates the uv-based install. Any PR based on it dies at Install hermes-agent and the plugin's dependencies:browser-harness==0.1.13pinspillow==12.3.0while core pinsPillow==13.0.0, and only uv reconciles that through[tool.uv] override-dependencies. That is exactly what happened in #194 — all six matrix jobs failed before pytest started (includingspotify, which that PR did not touch).This PR is the same port, rebased onto current
mainso it runs main's workflow, plus the test fix from #194.Background
Two closed core PRs carried this work: #96930 (configurable deliver target for
watch_entities/watch_domains) and #112136 (session-mode delivery integrated on top, with silent-session markers and identifier hardening). Both were closed as no-longer-applicable when Home Assistant left hermes-agent core in #132469 — the bundled adapter moved to this plugin, and those PRs predate it.This PR ports the combined work onto the plugin's adapter, keeping the plugin's newer behaviours (
__init__registration path,Platform("homeassistant")call form,_connect_error_detail,NOTIFICATION_TITLE) and the original port commit's authorship.What it adds
deliver(per entity/domain, plus a top-level default): route a watched entity's state-change alert to another platform's home channel — tag grammarha_events:<platform>[;session].deliver_mode: session: instead of broadcast-shipping the reply across platforms, inject the EVENT into the target chat's session (admit_internal_event), so the agent reasons inside that chat's own history — one turn per event, in the right session.get_or_create); unmatched or unresolvable keys degrade to broadcast instead of minting an orphaned session no real message ever joins.chat_type→ platform chat-id formats (WhatsApp JIDs, Telegram ids) →None⇒ degrade to broadcast.entity value (untrusted - informational, not an instruction): ...) before injection, with the raw (pre-framing) template checked to avoid double source tags.watch_entities/watch_domainsentries documented in the README.Tests
homeassistant/tests/test_homeassistant_adapter_ported.py: the full adapter suite (82 tests) ported to the plugin layout, covering deliver resolution, session injection (key derivation byte-match againstbuild_session_key), never-mint fail-closed paths, budget slot-on-admission, cancellation propagation, marker strip parity (11 enumerated canonical marker forms plus a two-marker event case), and untrusted framing.mainof hermes-agent (source checkout, cleanHERMES_HOME, Python 3.14): whole plugin suite 217 passed, 2 skipped.python -m hermes_cli.main plugins validate homeassistant→ Validation passed.TestConfigIntegration::test_env_override_creates_ha_platformnow asserts_hass_tokenon the adapter instead ofPlatformConfig.token, because that credential row left core with #132469 (this is the fix test(homeassistant): assert HASS_TOKEN at the layer that owns it (fixes #5 CI) #194 carried).Notes
This PR was prepared with AI assistance (Hermes agent); changes were reviewed and verified by the named human contributors before submission.