Skip to content

Automations & Insight Jobs

Call brAIn from any automation or script: ask it a question, hand it a job, or react when it finds or fixes something.

You want Use
An answer your automation can branch on brain.ask
A job done in the background, with a notification brain.run_task
One line of text, right now brain.send_prompt
A report on a dashboard every morning Insight jobs
brAIn behind Home Assistant’s Suggest with AI AI Task
To react when brAIn finds or fixes something Events and entities
Findings on your phone with no YAML findings_notify_service

Ask a question and branch on the answer

brain.ask takes a question and returns the answer as data. Give it the shape you want as a JSON schema, and the object that comes back has already been checked against it.

automation:
- alias: "Warn when any room is cold at bedtime"
trigger:
- platform: time
at: "22:00:00"
action:
- action: brain.ask
data:
question: Which rooms are below 18 °C right now, and how far below?
schema:
type: object
properties:
rooms:
type: array
items:
type: object
properties:
name: { type: string }
degrees_below: { type: number }
required: [name, degrees_below]
required: [rooms]
response_variable: cold
- if: "{{ cold.data.rooms | length > 0 }}"
then:
- action: notify.mobile_app_phone
data:
message: >-
Cold tonight: {{ cold.data.rooms | map(attribute='name') | join(', ') }}
  • response always holds the answer as text. data holds the object when you gave a schema.
  • It looks things up and changes nothing, unless you widen tools.
  • If the run fails, the action raises an error. An empty data is never a “no” in disguise.

Run a background job

brain.run_task runs a job in the background: an error-log digest, a config audit, a morning summary. It can notify you when it is done.

automation:
- alias: "Nightly error digest"
trigger:
- platform: time
at: "23:30:00"
action:
- action: brain.run_task
data:
prompt: >-
Check the Home Assistant error log for today. Summarize real
problems (ignore benign warnings) and suggest fixes.
tools: read_only
notify: true
notify_entity: notify.mobile_app_phone
timeout: 300
  • A task takes as many steps as it needs, within timeout.
  • The answer also comes back as response data, as text. For a checked object, use brain.ask.
  • notify: true with no notify_entity leaves a persistent notification in Home Assistant.
  • model lets a nightly digest run on haiku while everything else follows the app’s setting.

Get a one-line answer

brain.send_prompt waits for the answer and returns it. Use it inside a script that needs the text straight away.

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

It runs at the Voice assistant level, which is what Assist already gives any signed-in user.

Choose how much a task may touch

Set tools on brain.run_task and brain.ask.

tools What the task can reach Default for
read_only It can look at anything in Home Assistant and change nothing. It cannot read files. brain.ask
house Every Home Assistant tool, so it can read your house and act on it. No shell, no file reads or edits, no web.
full The shell, file edits, web access and every Home Assistant tool, including Power Tools, so a task can fix what it finds. brain.run_task

read_only and house cannot open files in /config, secrets.yaml included. If brAIn cannot load those two narrower tool lists when the task starts, the task is refused. It never falls back to full.

Who may call them

Caller What is allowed
Automations and scripts Everything. They run as the system.
A Home Assistant administrator Everything.
A signed-in user who is not an administrator brain.ask at read_only and brain.send_prompt only.

A non-administrator is refused on brain.run_task at house or full (and with no tools, which is full), on brain.ask wider than read_only, and on brain.add_memory, brain.study, brain.intent and brain.answer_question. More on what each part of brAIn may touch: Safety.

When a task fails

A failure raises an error that carries the reason, so it shows in the automation’s trace and never arrives as if it were the answer.

  • brain.run_task, brain.ask and brain.send_prompt raise a HomeAssistantError with a sentence a person can read. When the reason is a sign-in, it names the fix: ⚙ → Account → Sign in again.
  • brain_task_complete carries status: failed and an error code from a fixed list, such as auth, timeout, empty, refused, permission, paused, budget, partial and error. Branch on which failure it was.
  • To keep an automation going past a failure, add continue_on_error: true to the action.

Insight jobs

An insight job is a scheduled report that lands on a sensor, ready for a dashboard tile or a spoken briefing.

  1. Open Settings → Devices & Services → brAIn → Add service → Insight job.

  2. Pick a template (daily briefing, anomaly watch, battery & maintenance, camera check) or write your own prompt. A custom prompt can use templates such as {{ states('sensor.outdoor_temp') }}, rendered before each run.

  3. Set a schedule: an interval, a daily time (HH:MM), both, or manual only.

  4. After the first successful run, a notification gives you the dashboard card to paste.

Show the report on a dashboard
type: markdown
title: Morning Briefing
content: >-
{{ state_attr('sensor.morning_briefing_insight', 'markdown')
or 'No insight yet — run brain.run_insight.' }}
Run it now Every job has a Run now button. brain.run_insight runs one by name, or all of them with no name.
Read it The sensor’s attributes hold preview, the full markdown, and a ready-to-paste card_yaml.
React to it brain_insight_complete fires after every run with name, entity_id, success and preview. Use it for a spoken announcement.
It knows the house Each run gets what brAIn knows from memory, plus the previous report, so it notes what changed.
It changes nothing A job has no shell and no file edits. Only the camera check template may look at a camera, and only at cameras you ticked under ⚙ → Cameras & calendars.
It pauses with brAIn On its schedule, a job waits while Automatic insights is off or the usage budget is spent. Run now and brain.run_insight always run.
A failure stays a failure A failed run shows as an error on the sensor beside the last good report. It is never delivered as the report.

Jobs give you markdown for dashboards and events for announcements. Insight cards give you interactive analysis in the panel. Both read the same memory.

Answer Home Assistant’s AI Task

On Home Assistant 2025.7 and later, brAIn is an AI Task entity (ai_task.brain_system_ai_task on a fresh install). The Suggest with AI buttons and ai_task.generate_data can then be answered by an assistant that knows your house.

- action: ai_task.generate_data
data:
entity_id: ai_task.brain_system_ai_task
task_name: freezer check
instructions: Has the garage freezer been warmer than usual today?
structure:
warmer:
selector: { boolean: }
why:
selector: { text: }
response_variable: result
  • It runs like brain.ask: reading tools only, with what brAIn knows about the house.
  • A requested structure is checked before it is returned. A reply of the wrong shape is an error with the reason.
  • It needs the enable_automation_integration option on. Attachments are not read.

Give brAIn’s measurements to another assistant

Any other conversation agent (OpenAI’s, Google’s, a local model, or the Model Context Protocol server integration) can use brAIn measurements. Tick it under that agent’s Control Home Assistant setting (Home Assistant 2024.6 and later).

Tool Answers
brain_what_is_normal What an entity normally reads at this hour of the week, and how far it is from that now.
brain_recall What brAIn remembers about something, with who taught it and when.
brain_explain_change What changed an entity recently: an automation, a person, a voice command or brAIn.

All three are read-only. The entity asked about has to be exposed to that assistant under Settings → Voice assistants → Expose. Facts about entities it cannot see are left out, and an exposure that cannot be checked is refused. Leave assist_fast_mode on, because the voice workers serve these.

Events and entities

React when brAIn finds, fixes or learns something.

Tell the kitchen speaker when brAIn fixes something
automation:
- alias: "Announce brAIn fixes"
trigger:
- platform: event
event_type: brain_change
action:
- action: tts.speak
target: { entity_id: tts.home_assistant_cloud }
data:
media_player_entity_id: media_player.kitchen
message: "brAIn fixed something: {{ trigger.event.data.claim }}"
Event Fires when Carries
brain_case A finding opens on Needs you. Suggestions and guesses do not fire it. case_id, kind, claim, severity, status, entity_id, fixable, source
brain_case_ended That finding leaves the feed, whichever ending it got. A snooze fires nothing, going or coming back. case_id, kind, claim
brain_change brAIn changed something in the house. A Home Assistant restart does not replay old ones. case_id, claim, entity_id
brain_finding The same moment as brain_case, in the older shape. ts, text, severity, entity_id, fixable
brain_learned A fact was filed into memory. fact, source
brain_task_complete A brain.run_task or brain.ask task finished. task_id, status (completed or failed), error on a failure
brain_insight_complete An insight job ran. name, entity_id, success, preview
Entity What it is for
sensor.brain_findings_open_findings The open count, with the severity split and the texts as attributes.
binary_sensor.brain_needs_you On while anything waits for a decision.
todo.brain_system_to_do To Do, in Home Assistant’s To-do app (todo.brain_system_brain on an older install). Ticking an item is Done. Deleting one takes it off the list.
Repairs Every finding waiting on you, with its answers, under Settings → System → Repairs.
sensor.brain_status watching, paused, needs_restart, signed_out or degraded.
sensor.brain_system_health Whether brAIn itself is working (sensor.brain_usage_limits_health on an older install).
button.brain_system_run_house_checks Runs the house checks now.

These ids are what a fresh install gets. If you renamed anything, find yours under Settings → Devices & services → brAIn.

Send findings to your phone with no YAML

Set the findings_notify_service option to any notify.* service. Critical findings are pushed at once and asked about again, others are held through quiet hours, and each notification carries its answer buttons plus Reply. findings_notify_min_severity (default critical) decides what may ring. More: Notifications.

Service reference

Service What it does Fields
brain.ask A question in, the answer back as text and, with a schema, as a checked object. question*, schema, tools (default read_only), timeout (10 to 600 seconds)
brain.run_task A background job, with an optional notification. prompt*, tools (default full), model, notify, notify_entity, timeout (default 300, 10 to 600 seconds)
brain.send_prompt One prompt, one answer. prompt*, model, timeout (default 120)
brain.run_insight Run an insight job now. name (empty runs every job)
brain.check Run the house checks now. It returns at once, and what it finds arrives on Needs you a minute or two later. Two calls close together are one pass. none
brain.add_todo Add a line to brAIn’s To Do. text*
brain.add_memory Queue a fact for memory. The sources correction, confirmed and person are refused. fact*, source, confidence (high, medium, low)
brain.answer_question Answer a guess brAIn is waiting on, as Yes or No on Needs you does. Start answer with yes or no; anything else, or a guess that is not open, is refused. A reason after a no is kept as a correction. Name the guess by ts or by its wording. The Questions waiting sensor lists both. answer*, ts, question, source
brain.study Send brAIn to research a topic and file what it finds in memory. Built-in topics: naming, presence, energy, climate, devices, automations, lighting. topic (empty studies whatever is stalest)
brain.intent Turn one sentence into an automation, offered as a suggestion on Insights → Needs you. sentence*
brain.clear_conversation Reset a voice conversation. conversation_id (empty clears all)

* required. model is default, sonnet, opus or haiku. tools also accepts minecraft, which BRUH Minecraft uses for requests typed in the game’s chat.

Every Power Tools service is callable from an automation in the same way. Field details for all services: Reference.