Light turned on

The Light turned on 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 on. Use it to start an automation the moment the light lights up, whether someone flipped a physical switch, pressed a button in the UI, or called an action in another automation.

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 on, the last time the final targeted light turns on, or every single time any of them turn on.

Labs

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:

  1. Go to Settings > Automations & scenes.
  2. Open an existing automation, or select Create automation > Create new automation.
  3. In the When section, select Add trigger.
  4. From the search box, search for and select Light: Light turned on.
  5. 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.
  6. Under Trigger when, pick Any, First, or Last to control how the trigger behaves when multiple lights are targeted.
  7. Select Save.

Options in the UI

Trigger when (Required)

When multiple lights are targeted, controls when the trigger fires. Pick Any to fire every time any targeted light turns on, First to fire only when the first of a group of off lights turns on, or Last to fire only after every targeted light is on.

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_on. A basic example looks like this:

TriggerA trigger is a set of values or conditions of a platform that are defined to cause an automation to run. [Learn more]
trigger: light.turned_on
target:
  entity_id: light.kitchen

This fires every time light.kitchen transitions from off to on.

Options in YAML

YAML sometimes provides additional options for more complex use cases that are not available through the UI.

behavior string Required, default: any

When multiple lights are targeted, controls when the trigger fires. Accepts any, first, or last.

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. If a light comes back from being unavailable (unavailable) or having an unknown state (unknown), the trigger does not fire for that recovery.
  • Pair this trigger with Light is off to make sure the automation only runs when a specific target is expected to have been off first.
  • To react to the opposite transition, use Light turned 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.

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: notify when the hallway light comes on at night

When the hallway light turns on after sunset, send a phone notification so you know someone’s moving around the house.

  • Trigger: Light turned on
  • Target: Hallway light
  • Trigger when: Any
  • Condition: Sun is below horizon
  • Action: Send a mobile notification
YAML example for a nighttime hallway notification
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Notify on hallway light at night"
triggers:
  - trigger: light.turned_on
    target:
      entity_id: light.hallway
    options:
      behavior: any
conditions:
  - condition: sun
    after: sunset
actions:
  - action: notify.mobile_app_phone
    data:
      message: "Hallway light just turned on."

Automation: play welcome music when any downstairs light comes on in the morning

When the first downstairs light turns on in the morning, start a gentle playlist so you walk into a lively room.

  • Trigger: Light turned on
  • Target: Downstairs area
  • Trigger when: First
  • Condition: Time is between 06:00 and 10:00
  • Action: Media player: Play media
YAML example for a morning welcome playlist
AutomationAutomations in Home Assistant allow you to automatically respond to things that happen in and around your home. [Learn more]
alias: "Welcome music on first downstairs light"
triggers:
  - trigger: light.turned_on
    target:
      area_id: downstairs
    options:
      behavior: first
conditions:
  - condition: time
    after: "06:00:00"
    before: "10:00:00"
actions:
  - action: media_player.play_media
    target:
      entity_id: media_player.kitchen
    data:
      media_content_id: "spotify:playlist:37i9dQZF1DXdwmD5Q7Gxah"
      media_content_type: music

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.

Tip

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: