Light turned off
The Light turned off trigger fires after a light 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] turns off. Use it to start an automation the moment a light goes dark, whether someone flipped a physical switch, pressed a button in the UI, or called an action.
When you target more than one light, the trigger’s behavior option controls when it fires. You can have it fire the first time any targeted light turns off, the last time the final targeted light turns off, or every single time any of them turn off.
Requires the Purpose-specific triggers and conditions Labs preview feature. Enable it at Settings > System > Labs.
Using this trigger from the user interface
If you prefer building automations visually, Home Assistant walks you through this trigger step by step. You pick what to watch, tweak a few options, and save. No YAML knowledge required.
To use this trigger in an automation:
- Go to Settings > Automations & scenes.
- Open an existing automation, or select Create automation > Create new automation.
- In the When section, select Add trigger.
- From the search box, search for and select Light: Light turned off.
- Under Targets, choose what to watch:
- To watch a specific light, select the entity.
- To watch every light in a room, select an area.
- To watch every light on a floor, select a floor.
- To watch lights sharing a tag, select a label.
- Under Trigger when, pick Any, First, or Last.
- Select Save.
Options in the UI
Using this trigger 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 trigger as light.turned_off. A basic example looks like this:
trigger: light.turned_off
target:
entity_id: light.kitchen
This fires every time light.kitchen transitions from on to off.
Options in YAML
YAML sometimes provides additional options for more complex use cases that are not available through the UI.
Targets
This trigger supports targets. A target tells Home Assistant what the trigger should watch. You can point it at a single 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], a device, an area, a floor, or a label, and Home Assistant watches every matching light entity behind that target.
-
Entity: one specific light entity, such as
light.living_room. - Device: every light entity that belongs to a device.
- Area: every light entity in a room or area.
- Floor: every light entity on a floor.
- Label: every light entity that shares a label.
You can also mix target types in one trigger. For example, combine a specific entity with an area to watch both at once.
Good to know
- The trigger only fires when a light transitions from a known, valid state. Transitions from being unavailable (
unavailable) or having an unknown state (unknown) to off do not count. - To react to the opposite transition, use Light turned on.
- Pair this trigger with the
lastbehavior to run something once every light in an area is off, like turning off the TV when every light in the living room has been switched off.
Try it yourself
Ready to test this? Go to Settings > Automations & scenes, create a new automation, and add this trigger. Save the automation, then change the state of the targeted entity to watch the trigger fire on your actual entitiesAn 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].
More examples
Real scenarios where this trigger fires in automations and scripts. 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: arm the alarm when the last light goes off at night
When the last light in the house turns off late at night, arm the alarm automatically. A great way to forget a manual step without forgetting your security.
- Trigger: Light turned off
- Target: All lights (by label)
- Trigger when: Last
- Condition: Time is after 22:30
- Action: Alarm control panel: Arm away
YAML example for an arm-on-last-light automation
alias: "Arm alarm when last light off"
triggers:
- trigger: light.turned_off
target:
label_id: all_lights
options:
behavior: last
conditions:
- condition: time
after: "22:30:00"
actions:
- action: alarm_control_panel.alarm_arm_away
target:
entity_id: alarm_control_panel.home
Automation: turn off the media player when the living room goes dark
When every light in the living room is off, stop whatever is playing on the living room speaker. Saves energy and silence at the same time.
- Trigger: Light turned off
- Target: Living room area
- Trigger when: Last
- Action: Media player: Turn off
YAML example for auto-pausing media when the room goes dark
alias: "Stop media when living room dark"
triggers:
- trigger: light.turned_off
target:
area_id: living_room
options:
behavior: last
actions:
- action: media_player.turn_off
target:
entity_id: media_player.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 trigger 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 triggers or suggest the right one when you describe what you want in plain language.
Related triggers
These triggers work well alongside this one:
-
Light turned on - Triggers after one or more lights turn on.
-
Light brightness changed - Triggers after the brightness of one or more lights changes.