feat: Home Assistant settings UI + fix channels.json
notifications.html: add Home Assistant section with two collapsible blocks — Connection (HA URL + Long-Lived Access Token) and Inbound webhook (webhook ID with endpoint URL hint showing the username). Token field uses keep-existing pattern (blank = no change). settings.py: wire ha_url, ha_token, ha_webhook_id through _notifications_page() template substitution and save_notifications() POST handler. Preserves existing HA config fields (persona, tier, role, tools) on save. TODO__Agents.md: add Home Assistant integration planning section (event design, richer payload template, HA API tools). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -318,6 +318,58 @@
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<!-- Home Assistant -->
|
||||
<div class="section">
|
||||
<h2>Home Assistant</h2>
|
||||
<p class="hint" style="margin-bottom:1rem;">
|
||||
Receive events from HA automations and let Inara call the HA REST API
|
||||
(read states, control devices). Webhook ID is the shared secret used in your
|
||||
HA <code>rest_command</code> URL.
|
||||
</p>
|
||||
|
||||
<details class="channel-block" {{ ha_url and 'open' or '' }}>
|
||||
<summary>Connection</summary>
|
||||
<div class="channel-block-body">
|
||||
<p class="channel-hint">
|
||||
HA URL and a Long-Lived Access Token (Profile → scroll to bottom →
|
||||
Long-Lived Access Tokens → Create Token).
|
||||
</p>
|
||||
<div class="field">
|
||||
<label for="ha_url">Home Assistant URL</label>
|
||||
<input type="url" id="ha_url" name="ha_url"
|
||||
value="{{ ha_url }}"
|
||||
placeholder="https://ha.yourdomain.com"
|
||||
autocomplete="off" spellcheck="false">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label for="ha_token">Long-Lived Access Token</label>
|
||||
<input type="password" id="ha_token" name="ha_token"
|
||||
value=""
|
||||
placeholder="Leave blank to keep existing token"
|
||||
autocomplete="new-password" spellcheck="false">
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details class="channel-block" {{ ha_webhook_id and 'open' or '' }}>
|
||||
<summary>Inbound webhook (HA → Cortex)</summary>
|
||||
<div class="channel-block-body">
|
||||
<p class="channel-hint">
|
||||
The webhook ID is the shared secret in your HA <code>rest_command</code> URL.
|
||||
Your endpoint: <code>https://cortex.dgrzone.com/webhook/ha/{{ ha_username }}/<webhook_id></code>
|
||||
</p>
|
||||
<div class="field">
|
||||
<label for="ha_webhook_id">Webhook ID</label>
|
||||
<input type="text" id="ha_webhook_id" name="ha_webhook_id"
|
||||
value="{{ ha_webhook_id }}"
|
||||
placeholder="Paste or generate a random secret"
|
||||
autocomplete="off" spellcheck="false">
|
||||
<p class="hint">Treat this like a password — use a long, random string.</p>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
</div>
|
||||
|
||||
<!-- Google Chat -->
|
||||
<div class="section">
|
||||
<h2>Google Chat</h2>
|
||||
|
||||
Reference in New Issue
Block a user