Is not in zone
The Is not in zone condition passes when a selected person or device tracker is outside a selected zone. Use it to make an automation continue only when someone is away from home, away from work, or outside another zone that matters to the automation.
When you target more than one person or device tracker, the Check when option controls whether one matching target is enough or every selected target must be outside the zone.
Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.
Using this condition from the user interface
If you prefer building automations visually, Home Assistant walks you through this condition step by step. You pick what to check, tweak a few options, and save. No YAML knowledge required.
To use this condition in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the And if section, select Add condition.
- From the search box, search for and select Is not in zone.
- Select what you want to check. Under By target, choose one or more people or device trackers.
- Under Zone, select the zone to check against.
- If you selected more than one target, under Check when, pick Any or All.
- Under For at least, you can set how long the target must have been outside the zone before the condition passes. Leave it at zero for the condition to pass immediately.
- Select Save.
Options in the UI
Pick Any to pass if at least one selected target is outside the zone, or All to pass only when every selected target is outside the zone. The default is Any.
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, refer to this condition as zone.not_in_zone. A basic example looks like this:
condition: zone.not_in_zone
target:
entity_id: person.nina
options:
zone: zone.home
This passes when person.nina is not in zone.home.
Options in YAML
YAML sometimes provides additional options for more complex use cases that are not available through the UI.
When multiple people or device trackers are targeted, controls how results combine. Accepts any or all.
Targets of the condition
This condition requires a target. The target is the person or device tracker that Home Assistant will check.
-
Entity: one specific person or device tracker entity, such as
person.ninaordevice_tracker.phone. - Device: every matching person or device tracker entity that belongs to a device.
- Area: every matching person or device tracker entity in a room or area.
- Floor: every matching person or device tracker entity on a floor.
- Label: every matching person or device tracker entity that shares a label.
You can also select different target types in one condition.
Behavior with multiple targets
When you target more than one person or device tracker, the Check when option controls how the results combine:
- Any (default): the condition passes if at least one of the selected people or device trackers is outside the zone.
- All: the condition passes only when every selected person or device tracker is outside the zone.
Good to know
- This condition uses the
in_zonesattribute reported by person and device tracker entities. - If a selected person or device tracker is
unknownorunavailable, Home Assistant does not treat that target as being outside the zone. - To check the opposite state, use Is in zone.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, open an automation, and add this condition. Trigger the automation with and without the condition met, and watch whether it continues or stops.
More examples
Real scenarios where this condition gates an automation. Copy any example and adapt it to your setup.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the automation editor in Home Assistant, and press Ctrl+V (or Cmd+V on Mac). Home Assistant automatically converts the pasted YAML into the visual editor format, whether it’s a full automation, a single trigger, a condition, or an action.
Automation: turn off the office fan when Nina is not home
When the home zone becomes empty, this automation turns off the office fan if Nina is not in the home zone.
-
Trigger: Zone occupancy cleared
-
Zone: Home (
zone.home)
-
Zone: Home (
-
Condition: Is not in zone
-
Target: Nina (
person.nina) -
Zone: Home (
zone.home)
-
Target: Nina (
-
Action: Turn off fan
-
Target: Office fan (
fan.office)
-
Target: Office fan (
YAML example for turning off the office fan when Nina is not home
alias: "Turn off the office fan when Nina is not home"
triggers:
- trigger: zone.occupancy_cleared
options:
zone: zone.home
conditions:
- condition: zone.not_in_zone
target:
entity_id: person.nina
options:
zone: zone.home
actions:
- action: fan.turn_off
target:
entity_id: fan.office
Automation: notify if a phone is not at school in the morning
At 08:30, this automation sends a notification if a tracked phone is not in the school zone.
- Trigger: Time is 08:30
-
Condition: Is not in zone
-
Target: Phone (
device_tracker.phone) -
Zone: School (
zone.school)
-
Target: Phone (
-
Action: Send a notification message
-
Target: My Device (
notify.my_device)
-
Target: My Device (
YAML example for notifying if a phone is not at school
alias: "Notify if a phone is not at school"
triggers:
- trigger: time
at: "08:30:00"
conditions:
- condition: zone.not_in_zone
target:
entity_id: device_tracker.phone
options:
zone: zone.school
actions:
- action: notify.send_message
target:
entity_id: notify.my_device
data:
message: "The tracked phone is not at school."
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
These conditions work well alongside this one:
-
Is in zone: Tests if one or more people or device trackers are in a zone.
-
Zone occupancy is not detected: Tests if a zone is empty.