Repository navigation
Implement RFC-0018's read-only Home Assistant capabilities - #18
Merged
Merged
Conversation
home_assistant.list_entities and home_assistant.get_history, both read_only/external/required, reusing RFC-0017's confirmation pause/resume flow unchanged. The entity allowlist and "is this even configured" checks run at the executor's policy stage, before any confirmation prompt is generated and before any request reaches Home Assistant. Generalizes sovereign_capabilities.Capability/invoke() with policy_key (a per-capability policy flag, not a single blanket external_enabled) and policy_check (an argument-aware policy hook) -- backward compatible, web.search/web.fetch are unaffected, but enabling web search no longer silently enables Home Assistant too. Found and fixed two real bugs during implementation: a stale-module- cache issue where the capability's own config-path defaults didn't honor overrides after first import (fixed by threading explicit paths through registration into the implementation closures), and a missing entry in create-update-release.py's appliance file allowlist for the new lib module. Config/credentials, HTTP endpoints (GET/POST /home-assistant, GET /home-assistant/entities for the future settings-page allowlist picker), nginx routing, and the systemd ReadWritePaths grant are all included. Console's settings UI itself is explicit, named follow-up per RFC-0018 -- there is no way to configure Home Assistant from Console yet, only by writing to the config/token files directly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kasunben
marked this pull request as ready for review
August 21, 2026 20:23
Adds the connection settings (enable toggle, base URL, access token) and entity-allowlist picker to Console's Home Assistant page, wired to the real GET/POST /api/v1/conversation/home-assistant and GET .../entities endpoints. Reuses the existing preview-mockup page rather than a new one, since a later mutating-control milestone already owns it -- reworded the preview banner to scope it specifically to control (not reading, which is now real) and fixed the hero's previously-hardcoded "Connected homeassistant.local:8123" status/entity count to reflect the real, loaded config. The base URL field is a separate scheme <select> + host <input>, joined only at runtime -- a literal "http://"/"https://" placeholder would trip this project's own console-asset safety test (test_console_assets_are_local_and_safe), the same way a comment in sovereign_websearch.py did once already. Also adds home_assistant.list_entities/get_history to EXTERNAL_CAPABILITY_NAMES so chat receipts correctly show "left the network" for them, matching the fix already made for web.search/fetch. Manually verified end-to-end in a real browser against a stub backend: sign-in loads real state, connection save round-trips without ever re-displaying the token, the entity picker loads and correctly pre-checks the saved allowlist, saving the allowlist persists exactly the checked entities, and sign-out cleanly resets the UI. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kasunben
added a commit
that referenced
this pull request
Aug 21, 2026
The read-only slice (RFC-0018) shipped in PR #18 -- capability implementation, executor generalization, and Console settings UI are all done and verified. Real-hardware qualification remains the one open item, and it's a real blocker, not a scheduling gap: confirmed no Home Assistant instance exists on the household network yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
Implements the two read-only capabilities RFC-0018 (Accepted) maps:
home_assistant.list_entitiesandhome_assistant.get_history.sovereign_homeassistant.py) — bothread_only/external/required, reusing RFC-0017's confirmation pause/resume flow unchanged (no new wire-format code path). Entity allowlist and "is this even configured" checks run at the executor's policy stage, before any confirmation prompt and before any request reaches Home Assistant.sovereign_capabilities.py) —Capability/invoke()gainedpolicy_key(a distinct per-capability policy flag, replacing the single blanketexternal_enabledshare) andpolicy_check(an argument-aware policy hook). Backward compatible:web.search/web.fetchare unaffected, but enabling web search no longer silently enables Home Assistant too — that coupling would have been a real bug if the generic executor had stayed as-is.home-assistant.json(separate frompolicy.json, per RFC-0018's own resolution of an Unresolved Question RFC-0017 left open) and a new secrets subdirectory for the access token (separate from Pi-hole's own credential, so a compromisedsovereign-conversation.serviceprocess gains no new ability to touch it).GET/POST /api/v1/conversation/home-assistant(config),GET /api/v1/conversation/home-assistant/entities(an unfiltered proxy for the future settings-page allowlist picker) — plus nginx routing and the systemdReadWritePaths=grant.Real bugs found and fixed during implementation
read_config()/read_token()with no explicit path, so under a process that imports the module more than once with different overrides (real under a test runner; not a production concern, since a service imports this module exactly once), later overrides were silently ignored. Fixed by threading explicit paths throughregister()into the implementation closures, sobin/sovereign-conversation's own correctly-fresh-per-process constants are what capabilities actually use.scripts/create-update-release.py'sAPPLIANCE_FILESdidn't include the newlib/sovereign_homeassistant.py— caught immediately by the existing release-bundle test suite (test_update_release.py), not discovered later. Fixed.Console settings UI (added)
Built the connection settings (enable toggle, base URL, access token) and entity-allowlist picker on Console's Home Assistant page, wired to the real endpoints above. The base URL field is a scheme
<select>+ host<input>joined only at runtime, since a literalhttp:///https://placeholder would trip this project's own console-asset safety test. Also fixed the page's previously-hardcoded fake "Connected" status/entity-count display to reflect real, loaded config, and addedhome_assistant.*to the client's external-capability set so chat receipts correctly show "left the network" for it.Manually verified end-to-end in a real browser against a stub backend: sign-in loads real state, connection save round-trips without ever re-displaying the token, the entity picker loads and correctly pre-checks the saved allowlist, saving persists exactly the checked entities, and sign-out cleanly resets the UI.
Still not included
Real-hardware qualification against an actual Home Assistant instance — depends on one being reachable on the household network, a genuine, disclosed dependency RFC-0018 already named (Sovereign doesn't provision Home Assistant itself, unlike Pi-hole/SearXNG/llama.cpp).
Test plan
tests/test_homeassistant_capabilities.py(33 tests — config storage, policy_check, both implementations, full executor round trip), plus extensions totest_capabilities.py(policy_key/policy_check generalization),test_conversation.py(registry count,build_policymerging),test_conversation_service.py(all three new HTTP endpoints, confirmation-flow reuse, cross-feature independence fromweb_search_enabled, provisioning).🤖 Generated with Claude Code