Skip to content

Backups, Energy, Networks & More

Ask brAIn for the jobs that sit furthest behind the Settings screens: backups, energy history, Z-Wave, Thread, addresses, categories and options.

Ask brAIn

Prune the backups older than a month but keep the newest three.
The gas meter jumped by a million yesterday. Take the spike out.
Remove the dead Z-Wave node in the garage.
Which accounts haven't signed in for 90 days?
Put all the heating automations in a Heating category.
Add the new lamp to the Lounge lights group.

Most of these preview by default. brAIn shows you what would change, then makes the change when you say so. In YAML, pass dry_run: false.

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.

Backups

Service What it does Fields
brain.list_backups List every backup, newest first: name, date, size, where it is kept, and whether it is automatic, partial or password-protected. Needs Home Assistant 2025.1 or later. none
brain.create_backup Make a backup now and wait until it is done. Full, or partial on Home Assistant OS and Supervised. name, password and the partial choices need the Supervisor. partial, name, password, homeassistant, addons[], folders[]
brain.delete_backups Delete the backups a filter picks, by id, age, name or kind (automatic, manual, full, partial). keep_newest spares the newest few. Previews by default. A call with no filter, or one that would leave no backup, is refused. backup_id[], older_than_days, name_contains, kind, keep_newest, dry_run

Statistics and the energy dashboard

Service What it does Fields
brain.adjust_statistic_sum Add an amount to a meter’s long-term sum from one hour onward, to fix a wrong reading. A negative amount takes it away. Previews by default. statistic_id*, start_time*, adjustment*, unit, dry_run
brain.heal_statistic_spikes Take out the hours where a meter’s sum jumped absurdly: a counter glitch near 2^30, a sum that fell, or a change over max_hourly_change. Looks back days (default 30). Previews by default. statistic_id*, max_hourly_change, days, dry_run
brain.clear_orphaned_statistics Delete the statistics kept for entities that no longer exist. External statistics are never touched. Previews by default. statistic_id[], dry_run
brain.get_energy_prefs Read the energy dashboard’s sources (grid, solar, battery, gas, water) and individual devices. none
brain.save_energy_prefs Replace its sources and/or devices. Each list you give replaces the whole list, and every statistic named must be one the recorder keeps. Previews by default. energy_sources, device_consumption, device_consumption_water, dry_run

Z-Wave, Thread and addresses

Service What it does Fields
brain.zwave_remove_failed_node Remove a Z-Wave node the controller has marked dead, as Remove failed device does. A node that is not dead is refused. Name it by device_id or entity_id. Previews by default. device_id, entity_id, dry_run
brain.zwave_rebuild_node_routes Ask the controller to rebuild one node’s routes, and say whether it worked. device_id, entity_id
brain.list_thread_datasets List the Thread networks Home Assistant knows: name, channel and which is preferred. The network key is never returned. none
brain.set_preferred_thread_dataset Choose the network new Thread devices join. dataset_id*
brain.set_core_urls Set the internal and/or external address Home Assistant is reached at. An empty value clears it. Each is a scheme, a host and an optional port, with no path. internal_url, external_url, dry_run

Categories

Categories group the automation, script, scene and helper lists. scope is automation, script, scene or helpers.

Service What it does Fields
brain.create_category Create a category. Returns its category_id. scope*, name*, icon
brain.update_category Rename a category or change its icon. scope*, category_id*, name, icon
brain.delete_category Delete a category. What was in it is left uncategorised, and listed. scope*, category_id*, dry_run
brain.set_entity_category Put automations, scripts, scenes or helpers in a category. Leave category_id empty to take them out. entity_id[]*, scope*, category_id

Integrations, groups, users and dashboards

Service What it does Fields
brain.set_integration_options Change an integration’s options through its own Configure form. Only the fields you name change. dry_run: true lists the fields the form asks for. A form with more than one step, or a menu, is refused with what it asked for. config_entry_id*, options, dry_run
brain.set_group_members Set (entities), add to or take from the members of a group helper made in the UI. Members must be the group’s kind. Returns the members before and after. entity_id*, entities[], add[], remove[], dry_run
brain.list_users List every user with their groups, whether they are active, local-only or a system user, and when each sign-in was last used. unused_for_days marks the unused ones. Token values are never returned. include_system, unused_for_days
brain.set_user_group Make a user admin, user or read_only. The owner, system users and the last administrator are refused. user_id*, group*, dry_run
brain.update_dashboard_info Change a dashboard’s sidebar title and icon, whether it shows in the sidebar, and whether only admins see it. Returns the settings before and after. url_path*, title, icon, show_in_sidebar, require_admin, dry_run

Examples

Prune old backups, keep the newest three
action: brain.delete_backups
data:
older_than_days: 30
keep_newest: 3
dry_run: false
Preview a spike repair
action: brain.heal_statistic_spikes
data:
statistic_id: sensor.gas_meter
max_hourly_change: 50
response_variable: spikes # nothing changes until dry_run is false
Find accounts nobody uses
action: brain.list_users
data:
unused_for_days: 90
response_variable: users

See also Users, Dashboards, Helpers and Devices & Integrations.