Skip to content

Blueprints & Statistics

Give brAIn a blueprint link and it imports and configures it. Give it meter history and it backfills your long-term statistics.

Ask brAIn

Import this motion-activated-light blueprint from the forum and set it up for the hallway.
My energy dashboard has a gap from when the meter was offline. Backfill it from this CSV.
Bring the gas meter history over from my old system.

What brAIn can do

Every service is admin-only. Call one from Developer tools → Actions, a script or an automation, or ask brAIn. * marks a required field, and [] marks a field that takes one value or a list.

Service What it does Fields
brain.import_blueprint Import an automation or script blueprint from a Home Assistant community forum topic, a GitHub file or a Gist. Returns the blueprint’s domain, name and file path. url*
brain.import_statistics Import or backfill long-term statistics rows. Reports only unless you pass dry_run: false: the preview gives the affected time range and the existing rows that would be overwritten. statistic_id*, has_mean*, has_sum*, name, unit_of_measurement, stats[]*, dry_run

Fields of import_statistics:

Field What to send
statistic_id An entity ID (sensor.gas_meter) for recorder statistics, or an external ID (bruh:solar_forecast).
has_mean true when rows carry mean, min and max (measurements).
has_sum true when rows carry state and sum (metered totals such as energy).
name, unit_of_measurement Display name and unit of the values.
stats The rows. Each needs a start at the top of an hour, plus mean/min/max and/or state/sum.

Examples

Import a blueprint
action: brain.import_blueprint
data:
url: https://community.home-assistant.io/t/motion-activated-light/123456
Backfill two hours of gas meter history
action: brain.import_statistics
data:
statistic_id: sensor.gas_meter
has_mean: false
has_sum: true
unit_of_measurement: "m³"
dry_run: false # leave out to preview
stats:
- start: "2026-07-01T00:00:00+00:00"
state: 1234.5
sum: 1234.5
- start: "2026-07-01T01:00:00+00:00"
state: 1235.1
sum: 1235.1

To fix a wrong reading or a spike in existing history, see Statistics and the energy dashboard.