Not
The Not condition groups one or more conditions and passes only if none of them pass. Use it when an automation should not continue in a certain situation. For example, the automation sends a notification when a door opens, but only if nobody is home.
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.
- Select Blocks, then select Not.
- To add Not inside an And or an Or condition, select Add condition inside that condition, and then select Blocks > Not.
- Inside the Not condition, select Add condition, and add the conditions that must not pass.
- You can add any condition, including other And, Or, and Not conditions.
- Select Save.
Options in the UI
The Not condition has no options of its own. It checks the conditions that you add inside it.
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, use condition: not, with the conditions under conditions. A basic example looks like this:
condition: not
conditions:
- condition: state
entity_id: person.alex
state: "home"
- condition: state
entity_id: alarm_control_panel.home_alarm
state: "disarmed"
This passes if Alex isn’t home, and the alarm isn’t disarmed.
There is also a shorter form, with the conditions under not:
not:
- condition: state
entity_id: person.alex
state: "home"
- condition: state
entity_id: alarm_control_panel.home_alarm
state: "disarmed"
Options in YAML
Good to know
- With several conditions, Not only passes if none of them pass. To pass if at least one of them doesn’t pass, put them in an And condition inside the Not condition. For an example, refer to Automation: send a reminder at night when not all doors are locked.
- The conditions are checked in order. As soon as one of them passes, the rest aren’t checked.
- If an entity usually only has two states, like a light, you often don’t need Not. For example, to check that a light is off, use a State condition with the state Off. The difference: Not with the state On also passes when the light is unavailable (
unavailable) or unknown (unknown).
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. In the visual editor, select the UI options listed in the example or paste the YAML code.
You don’t need to edit YAML to use these examples. Copy a YAML snippet from this page, open the visual 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: send a notification when a door opens and nobody is home
When the front door opens, this automation sends a notification, but only if neither Alex nor Sam is home.
-
Trigger: State changed
-
Entity: Front door (
binary_sensor.front_door) - To: Open
-
Entity: Front door (
-
Condition: Not
-
Condition: State
-
Entity: Alex (
person.alex) - State: Home
-
Entity: Alex (
-
Condition: State
-
Entity: Sam (
person.sam) - State: Home
-
Entity: Sam (
-
Condition: State
-
Action: Send a notification message
-
Target: My Device (
notify.my_device) - Message: The front door opened while nobody is home.
-
Target: My Device (
YAML example for the door notification
alias: "Notify when the door opens and nobody is home"
triggers:
- trigger: state
entity_id: binary_sensor.front_door
to: "on"
conditions:
- condition: not
conditions:
- condition: state
entity_id: person.alex
state: "home"
- condition: state
entity_id: person.sam
state: "home"
actions:
- action: notify.send_message
target:
entity_id: notify.my_device
data:
message: "The front door opened while nobody is home."
Automation: turn off the living room lights at night, unless the TV is playing
At 23:00, this automation turns off the living room lights, but not while the TV is playing.
-
Trigger: Time
-
At time:
23:00
-
At time:
-
Condition: Not
-
Condition: State
-
Entity: Living room TV (
media_player.living_room_tv) - State: Playing
-
Entity: Living room TV (
-
Condition: State
-
Action: Turn off light
-
Target: Living room lights (
light.living_room)
-
Target: Living room lights (
YAML example for turning off the living room lights
alias: "Turn off living room lights unless the TV is playing"
triggers:
- trigger: time
at: "23:00:00"
conditions:
- condition: not
conditions:
- condition: state
entity_id: media_player.living_room_tv
state: "playing"
actions:
- action: light.turn_off
target:
entity_id: light.living_room
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: