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.

Labs

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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the And if section, select Add condition.
  4. From the search box, search for and select Is not in zone.
  5. Select what you want to check. Under By target, choose one or more people or device trackers.
  6. Under Zone, select the zone to check against.
  7. If you selected more than one target, under Check when, pick Any or All.
  8. 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.
  9. Select Save.

Options in the UI

Zone (Required)

The zone to test against.

Check when (Optional)

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.

For at least (Optional)

How long the target must have been outside the zone before the condition passes. The default is zero, which passes immediately.

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:

ConditionConditions are an optional part of an automation that will prevent an action from firing if they are not met. [Learn more]
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.

zone string Required

The zone to test against.

behavior string

When multiple people or device trackers are targeted, controls how results combine. Accepts any or all.

for string

How long the target must have been outside the zone before the condition passes. Accepts a duration string in HH:MM:SS format or a time period mapping in hours, minutes, and seconds.

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.nina or device_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_zones attribute reported by person and device tracker entities.
  • If a selected person or device tracker is unknown or unavailable, 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.

Tip

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)
  • Condition: Is not in zone
    • Target: Nina (person.nina)
    • Zone: Home (zone.home)
  • Action: Turn off fan
    • Target: Office fan (fan.office)
YAML example for turning off the office fan when Nina is not home
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
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)
  • Action: Send a notification message
    • Target: My Device (notify.my_device)
YAML example for notifying if a phone is not at school
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
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.

Tip

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: