Skip to content

Zones & Persons

Ask brAIn to set up the places your automations care about and the people whose phones say where they are.

Ask brAIn

Create a zone for the gym so automations know when I'm there.
The gym zone keeps missing me in the parking lot. Make it bigger.
Add Alex to the house and track them with their phone.
Alex goes by Alexandra now. Rename them.
Stop tracking Alex's old phone.
Remove the old roommate from presence tracking.

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.

Zones

Service What it does Fields
brain.create_zone Create a zone. radius is in meters and defaults to 100. A passive zone is used by automations only and is not shown on the map. name*, latitude*, longitude*, radius, icon, passive
brain.update_zone Move, resize, rename or restyle a zone. Only the fields you pass change. entity_id*, name, latitude, longitude, radius, icon, passive
brain.delete_zone Delete zones that were made in the UI. dry_run: true lists what would go. entity_id[]*, dry_run

Persons

Name the person by entity_id (person.alex), person_id, or person (their name, not case-sensitive).

Service What it does Fields
brain.create_person Create a person, optionally linked to a Home Assistant user and with device trackers. Returns the person’s id. name*, user_id, device_tracker[]
brain.rename_person Rename a person. entity_id, person_id, person, name*
brain.add_device_tracker_to_person Attach device trackers to a person. Returns what was added and the person’s trackers now. entity_id, person_id, person, device_tracker[]*
brain.remove_device_tracker_from_person Detach device trackers. Returns what was removed, anything named that the person did not have, and the trackers now. entity_id, person_id, person, device_tracker[]*
brain.delete_person Delete a person. dry_run: true shows the person and their trackers first. entity_id, person_id, person, dry_run

Good to know

  • These services change zones and persons made in the UI. Ones defined in YAML are refused, and brAIn edits the file instead.
  • zone.home, when it is set in configuration.yaml, cannot be edited. That is a Home Assistant rule.

Examples

Create a zone, then widen it
- action: brain.create_zone
data:
name: Gym
latitude: 52.3702
longitude: 4.8952
radius: 150
icon: mdi:dumbbell
- action: brain.update_zone
data:
entity_id: zone.gym
radius: 250
Add a person with their phone
action: brain.create_person
data:
name: Alex
device_tracker:
- device_tracker.alex_phone
Swap a person's phone
- action: brain.add_device_tracker_to_person
data:
person: Alex
device_tracker:
- device_tracker.alex_new_phone
- action: brain.remove_device_tracker_from_person
data:
person: Alex
device_tracker:
- device_tracker.old_phone