Zone occupancy is not detected

The Zone occupancy is not detected condition passes when the selected zone is empty. Use it to make an automation continue only if no person is in a 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 Zone occupancy is not detected.
  5. Under Zone, select the zone to check.
  6. Under For at least, you can set how long the zone must have been empty before the condition passes. Leave it at zero for the condition to pass immediately.
  7. Select Save.

Options in the UI

Zone (Required)

The zone to monitor.

For at least (Optional)

How long the zone must have been empty 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.occupancy_is_not_detected. 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.occupancy_is_not_detected
options:
  zone: zone.home

This passes when zone.home is empty.

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 monitor.

for string

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

Good to know

  • A zone is empty when its state is 0.
  • If the zone state is unknown or unavailable, the condition does not pass.
  • To check the opposite state, use Zone occupancy is detected.

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: run the vacuum only when home is empty

At 10:00, this automation starts the robot vacuum if the home zone is empty.

  • Trigger: Time is 10:00
  • Condition: Zone occupancy is not detected
    • Zone: Home (zone.home)
  • Action: Start vacuum cleaner
    • Target: Downstairs vacuum (vacuum.downstairs)
YAML example for running the vacuum only when home is empty
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Run the vacuum when home is empty"
triggers:
  - trigger: time
    at: "10:00:00"
conditions:
  - condition: zone.occupancy_is_not_detected
    options:
      zone: zone.home
actions:
  - action: vacuum.start
    target:
      entity_id: vacuum.downstairs

Automation: turn off the porch light if home is empty after sunrise

At sunrise, this automation turns off the porch light if the home zone is empty.

  • Trigger: Sun rises
  • Condition: Zone occupancy is not detected
    • Zone: Home (zone.home)
  • Action: Turn off light
    • Target: Porch light (light.porch)
YAML example for turning off the porch light if home is empty
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Turn off the porch light after sunrise if home is empty"
triggers:
  - trigger: sun
    event: sunrise
conditions:
  - condition: zone.occupancy_is_not_detected
    options:
      zone: zone.home
actions:
  - action: light.turn_off
    target:
      entity_id: light.porch

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: