Zone
The Zone condition checks whether a person, a device tracker, or another entityAn entity represents a sensor, actor, or function in Home Assistant. Entities are used to monitor physical properties or to control other entities. An entity is usually part of a device or a service. [Learn more] with a location is in a zone. You can check several entities and several zones in one condition. For example, the condition can check whether Sam is at work or at the gym.
This is an older condition. When you select Add condition, it isn’t in the list anymore, but automations that use it keep working. For new automations, use the conditions in the Zone group, such as Is in zone. This page helps you read and change automations that already use the Zone condition.
Choosing a zone condition for new automations
For new automations, use these conditions instead:
- Whether people or device trackers are in a zone: Is in zone
- With For at least, it can also check how long they’ve been there.
- Whether people or device trackers are not in a zone: Is not in zone
- Whether one person or device tracker is in one of several zones: an Or block with an Is in zone condition for each zone
- Whether anyone is in a zone: Zone occupancy is detected
- Whether an entity that isn’t a person or a device tracker is in a zone: no newer condition checks this. Keep using the Zone condition in YAML.
Editing this condition in the UI
When you open an automation that uses the Zone condition, the editor shows its options:
The person, device tracker, or other entity with a location to check.
The editor shows one entity and one zone. To check several entities or zones, edit the condition in YAML.
To switch to a newer condition, delete the Zone condition, then add one from the Zone group.
Using this condition in YAML
If you work directly in YAML, or you want to know exactly what Home Assistant does under the hood, this section has the technical reference. It lists the field names you use in YAML, their types, and which ones are required.
In YAML, the condition uses condition: zone. A basic example looks like this:
condition: zone
entity_id: person.sam
zone: zone.home
This passes when Sam is home.
Options in YAML
Entity with location is entity_id, and Zone is zone. In YAML, both also accept a list.
The entity to check, or a list of entities. Use a person, a device tracker, or another entity with latitude and longitude attributes. With a list, every entity must be in one of the zones.
The following example passes if Sam is at work or at the gym:
condition: zone
entity_id: person.sam
zone:
- zone.work
- zone.gym
Good to know
- With several entities, the condition only passes if every entity is in one of the zones. They don’t have to be in the same zone.
- For people and device trackers, the condition uses the zones they’re in, from their
in_zonesattribute. For other entities, and for device trackers without that attribute, it uses theirlatitudeandlongitudeattributes and their GPS accuracy. - If an entity is unavailable or unknown, it doesn’t count as being in a zone, so the condition doesn’t pass.
- A person without a location doesn’t count as being in a zone.
- If the zone or the entity doesn’t exist, or an entity other than a person has no location, the condition fails with an error. The error is shown in the trace.
Examples
These examples show automations that use the Zone condition, and what to use instead in a new automation.
Automation: turn on the hallway light when the door opens and Sam is home
When the front door opens, this automation turns on the hallway light, but only if Sam is home.
-
Trigger: State changed
-
Entity: Front door (
binary_sensor.front_door) - To: Open
-
Entity: Front door (
-
Condition: Zone
-
Entity with location: Sam (
person.sam) -
Zone: Home (
zone.home)
-
Entity with location: Sam (
-
Action: Turn on light
-
Target: Hallway light (
light.hallway)
-
Target: Hallway light (
In a new automation, use Is in zone instead.
YAML example for the hallway light when Sam is home
alias: "Hallway light when the door opens and Sam is home"
triggers:
- trigger: state
entity_id: binary_sensor.front_door
to: "on"
conditions:
- condition: zone
entity_id: person.sam
zone: zone.home
actions:
- action: light.turn_on
target:
entity_id: light.hallway
Automation: remind Sam to buy groceries when at work or at the gym
At 17:00, this automation sends Sam a reminder to buy groceries, but only if Sam is at work or at the gym. This condition checks two zones, so it’s written in YAML.
In a new automation, use an Or block with an Is in zone condition for each zone instead.
YAML example for a grocery reminder
alias: "Grocery reminder after work or the gym"
triggers:
- trigger: time
at: "17:00:00"
conditions:
- condition: zone
entity_id: person.sam
zone:
- zone.work
- zone.gym
actions:
- action: notify.send_message
target:
entity_id: notify.my_device
data:
message: "Don't forget to buy groceries on your way home."
Still stuck?
The Home Assistant community is quick to help: join Discord for real-time chat, post on the community forum with the condition you’re using and what you expected to happen, or share on our subreddit /r/homeassistant.
AI assistants like ChatGPT or Claude can also explain conditions or suggest the right one when you describe what you want in plain language.
Related conditions
Explore related conditions:
-
Is in zone: Tests if one or more people or device trackers are in a zone.
-
Is not in zone: Tests if one or more people or device trackers are not in a zone.
-
Zone occupancy is detected: Tests if one or more zones are occupied.