Skip to content

Automations & Insight Jobs

Three ways to put Claude to work without opening the terminal.

brain.run_task — background jobs

Runs Claude as a background task from any automation or script — error-log digests, config audits, morning summaries — with an optional notification when it’s done.

automation:
- alias: "Nightly error digest"
trigger:
- platform: time
at: "23:30:00"
action:
- service: brain.run_task
data:
prompt: >-
Check the Home Assistant error log for today. Summarize real
problems (ignore benign warnings) and suggest fixes.
notify: true
notify_entity: notify.mobile_app_phone
timeout: 300

Tasks run with a generous agentic budget (automation_max_turns, default 30 — nobody is waiting on a background job) and full MCP access — including Power Tools, so a task can fix what it finds, not just report it. Responses are also returned as service response data for use in the same automation.

notify: true sends a notification when the task completes, and notify_entity picks the notify service that gets it — omit it for a persistent notification in the HA UI. (Before 1.26.0, notify: true silently did nothing: the listener posted a key the notify schema rejects, so every completion notification was a silent 400.) A model field on both brain.run_task and brain.send_prompt overrides the model per call (default, sonnet, opus, haiku), so a nightly digest can run on Haiku while everything else follows the add-on setting.

brain.send_prompt — one-shot Q&A

A synchronous question → answer call, ideal inside scripts that need Claude’s answer immediately:

- service: brain.send_prompt
data:
prompt: "In one sentence: is anything in the house open or unlocked right now?"
response_variable: claude
- service: notify.mobile_app_phone
data:
message: "{{ claude.response }}"

Insight jobs

Scheduled reports rendered to sensors — the dashboard-native sibling of the panel’s insight cards.

Create them from the integration: Settings → Devices & Services → brAIn → Add service → Insight job. Pick a shipped template — daily briefing, anomaly watch, battery & maintenance, camera check — or write a custom prompt. Custom prompts can embed HA templating ({{ states('sensor.outdoor_temp') }}), rendered just before each run.

  • Scheduling: an interval, a daily time (HH:MM), both, or manual-only. Every job also gets a Run now button, and brain.run_insight triggers by name from automations.
  • Reading it: the report lives in the sensor’s attributes — preview, full markdown, and ready-to-paste card_yaml. After the first successful run you get a notification containing the dashboard card.
  • Continuity: each run receives the home memory plus the previous report, so recurring insights note what changed instead of rediscovering the house.
  • Events: brain_insight_complete fires after every run with name, entity_id, success, and a preview — ideal for TTS announcements.
type: markdown
title: Morning Briefing
content: >-
{{ state_attr('sensor.morning_briefing_insight', 'markdown')
or 'No insight yet — run brain.run_insight.' }}

Jobs or insight cards? Jobs produce glanceable markdown on dashboards and TTS-able events; cards produce interactive visual analysis you click into. Both read the same memory, so most homes use jobs for tiles and briefings, and cards for deep dives.

Findings in automations

The findings work list lives in the add-on’s /data, which Home Assistant can’t see — so the add-on mirrors it to /config/.brain/findings_state.json on every change, and the integration builds three automation surfaces on it:

  • sensor.brain_open_findings — state is the open count, ready for a numeric-state trigger, with the severity split and the finding texts as attributes — enough to put what’s actually broken on a lock screen.
  • The brain_finding event fires once per newly-filed finding, visible in the logbook. Deduping happens in the store, across every status and the settled ledger, so the same problem can never fire twice.
  • Zero YAML: set the findings_notify_service option to any notify.* service and findings_notify_min_severity to the severity allowed to ring your phone (default serious), and new findings at or above it are pushed with no automation at all.

brain_learned fires the same way when a fact is filed into memory — though only actually since 1.26.0: the watcher behind it was documented from the start but never started. The other direction is brain.add_memory, which queues a fact from an automation; its optional source field records where the fact came from, so the consolidator knows who’s talking.

Power Tools from automations

Every Power Tools service is a normal HA service — automations can call them directly, no Claude in the loop:

# Flag it in Repairs when the washer finishes but nobody empties it
- service: brain.create_repair_issue
data:
title: "Washing machine done"
description: "Cycle finished over 2 hours ago and the door hasn't opened."
severity: warning
issue_id: washer_forgotten