Custom component under integrations/home-assistant/: registers the
/api/webhook/ai_agent webhook, renders notify events with the per-type
channel map, and renders asks on a dedicated 'Claude · Ask' channel with
the '. .. .._' vibration pattern as persistent tappable notifications —
the tapped answer is POSTed back to /api/ask/{id}/answer and the
notification cleared. install.sh copies it into the HA config and wires
configuration.yaml.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
78 lines
3.9 KiB
Python
78 lines
3.9 KiB
Python
"""Constants for the AI Agent notifications integration."""
|
|
|
|
DOMAIN = "ai_agent"
|
|
|
|
CONF_WEBHOOK_ID = "webhook_id"
|
|
CONF_NOTIFY_TARGET = "notify_target"
|
|
CONF_CALLBACK_URL = "callback_url"
|
|
|
|
DEFAULT_WEBHOOK_ID = "ai_agent"
|
|
DEFAULT_NOTIFY_TARGET = "mobile_app_pixel_9"
|
|
# The ai-agent backend's host-published port (HA runs on the host network).
|
|
DEFAULT_CALLBACK_URL = "http://127.0.0.1:8096"
|
|
|
|
# Asks get their own Android notification channel so they buzz distinctly.
|
|
# NOTE: Android locks a channel's importance/vibration when the channel is
|
|
# first created — to re-tune, rename the channel (or clear the companion app's
|
|
# storage).
|
|
ASK_CHANNEL = "Claude · Ask"
|
|
ASK_IMPORTANCE = "max"
|
|
# Vibration pattern ". .. .._" in morse-ish groups (ms: delay, on, off, on, …):
|
|
# dot = 100ms buzz, dash = 450ms buzz,
|
|
# gap inside a group = 120ms, gap between groups = 350ms.
|
|
# ".": 100
|
|
# "..": 100 120 100
|
|
# ".._": 100 120 100 120 450
|
|
ASK_VIBRATION = "0, 100, 350, 100, 120, 100, 350, 100, 120, 100, 120, 450"
|
|
ASK_ICON = "mdi:comment-question"
|
|
ASK_COLOR = "#7c3aed"
|
|
|
|
# Per-type icon / color / channel / importance / vibration defaults, mirroring
|
|
# the notify-done skill's notify.sh map. Explicit fields in the webhook payload
|
|
# always win over these.
|
|
TYPE_STYLES = {
|
|
"deploy": ("mdi:rocket-launch", "#7c3aed", "Claude · Deploy", "high",
|
|
"0, 200, 100, 200, 100, 400"),
|
|
"code": ("mdi:code-tags", "#2563eb", "Claude · Code", "default", "0, 120"),
|
|
"config": ("mdi:code-tags", "#2563eb", "Claude · Code", "default", "0, 120"),
|
|
"build": ("mdi:hammer-wrench", "#d97706", "Claude · Build", "high",
|
|
"0, 150, 80, 150"),
|
|
"git": ("mdi:source-branch", "#ea580c", "Claude · Git", "default", "0, 100"),
|
|
"commit": ("mdi:source-branch", "#ea580c", "Claude · Git", "default", "0, 100"),
|
|
"service": ("mdi:docker", "#0ea5e9", "Claude · Service", "default", "0, 150"),
|
|
"container": ("mdi:docker", "#0ea5e9", "Claude · Service", "default", "0, 150"),
|
|
"ai": ("mdi:robot", "#9333ea", "Claude · AI", "high",
|
|
"0, 100, 50, 100, 50, 100"),
|
|
"mcp": ("mdi:robot", "#9333ea", "Claude · AI", "high",
|
|
"0, 100, 50, 100, 50, 100"),
|
|
"music": ("mdi:music", "#16a34a", "Claude · Music", "default", "0, 120"),
|
|
"download": ("mdi:music", "#16a34a", "Claude · Music", "default", "0, 120"),
|
|
"media": ("mdi:movie-open", "#db2777", "Claude · Media", "default", "0, 120"),
|
|
"jellyfin": ("mdi:movie-open", "#db2777", "Claude · Media", "default", "0, 120"),
|
|
"research": ("mdi:book-search-outline", "#0d9488", "Claude · Research",
|
|
"high", "0, 150, 80, 150"),
|
|
"logs": ("mdi:chart-line", "#65a30d", "Claude · Logs", "default", "0, 100"),
|
|
"metrics": ("mdi:chart-line", "#65a30d", "Claude · Logs", "default", "0, 100"),
|
|
"dns": ("mdi:dns", "#0891b2", "Claude · DNS", "default", "0, 100"),
|
|
"auth": ("mdi:shield-lock", "#dc2626", "Claude · Security", "max",
|
|
"0, 300, 150, 300, 150, 300"),
|
|
"security": ("mdi:shield-lock", "#dc2626", "Claude · Security", "max",
|
|
"0, 300, 150, 300, 150, 300"),
|
|
"mail": ("mdi:email", "#4f46e5", "Claude · Mail", "high", "0, 120"),
|
|
"success": ("mdi:check-circle", "#16a34a", "Claude · Success", "high",
|
|
"0, 150, 75, 150"),
|
|
"done": ("mdi:check-circle", "#16a34a", "Claude · Success", "high",
|
|
"0, 150, 75, 150"),
|
|
"backup": ("mdi:cloud-upload", "#0d9488", "Claude · Backup", "default",
|
|
"0, 120"),
|
|
"error": ("mdi:alert-circle", "#dc2626", "Claude · Error", "max",
|
|
"0, 400, 150, 400, 150, 400"),
|
|
"fail": ("mdi:alert-circle", "#dc2626", "Claude · Error", "max",
|
|
"0, 400, 150, 400, 150, 400"),
|
|
"warn": ("mdi:alert", "#d97706", "Claude · Warning", "high",
|
|
"0, 300, 150, 300"),
|
|
"warning": ("mdi:alert", "#d97706", "Claude · Warning", "high",
|
|
"0, 300, 150, 300"),
|
|
}
|
|
DEFAULT_STYLE = ("mdi:bell", "#6b7280", "Claude Code", "high", "0, 250")
|