Actions: What an Automation Actually Does
The action block is the payoff of an automation — it's the work that runs once the trigger fires and any conditions clear. Actions are written in the same script syntax used everywhere else, so they can call services, fire events, and generally drive anything in your setup.
How Actions Are Shaped
Each action typically names an entity_id to act on plus any extra parameters
the service accepts — brightness, color, temperature, and so on. Rather than
spelling out every device setting by hand, you can also flip on a scene and let
that scene describe the desired end state for a whole group of devices.
Example 1: Setting Lights at Sunset
When the sun goes down, this automation drives two lamps to a warm amber at roughly two-thirds brightness.
automation:
# Push the porch and hallway lamps to amber at sunset.
triggers:
- trigger: sun
event: sunset
actions:
- action: light.turn_on
target:
entity_id:
- light.porch_lamp
- light.hallway_lamp
data:
brightness: 170
rgb_color: [255, 170, 40]
Example 2: A Notification, a Pause, Then Another
Because actions run as a script, you can chain several together and slot a
delay between them. Here a templated notification target sends one alert, the
automation waits, then sends a follow-up.
automation 2:
# Ping my phone shortly before sunset, then again afterward.
triggers:
- trigger: sun
event: sunset
offset: -00:20
variables:
alert_target: notify.maria_pixel
actions:
# The list of actions doubles as a mini script.
- action: "{{ alert_target }}"
data:
message: "Catch the sunset, it's starting!"
- delay: 0:25
- action: notify.notify
data:
message: "And that's a wrap on today's sunset."
Mixing Conditions into the Action List
Conditions aren't limited to the top-level conditions block — you can drop them
straight into the action sequence. WoowTech walks the list top to bottom, and the
moment a condition comes back false it stops, skipping everything after it.
Example 3: Evening Scene, Gated Midway
The automation fires on occupancy, always sends a heads-up notification, then checks whether it's dark enough before continuing to set the scene and switch on the lamps.
automation:
- alias: "Den evening lighting"
triggers:
- trigger: state
entity_id: binary_sensor.den_presence
to: "on"
actions:
- action: notify.notify
data:
message: "Den presence detected"
- condition: or
conditions:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: 6
- condition: numeric_state
entity_id: sensor.den_illuminance
below: 15
- action: scene.turn_on
target:
entity_id: scene.den_evening
- action: light.turn_on
target: "{{ {'entity_id': ['light.den_main', 'light.den_corner']} }}"
- action: switch.turn_on
target:
label_id: "{{ ['den_evening', 'den_after_dusk'] }}"
Actions: What an Automation Actually Does
The action block is the payoff of an automation — it's the work that runs once the trigger fires and any conditions clear. Actions are written in the same script syntax used everywhere else, so they can call services, fire events, and generally drive anything in your setup.
How Actions Are Shaped
Each action typically names an entity_id to act on plus any extra parameters
the service accepts — brightness, color, temperature, and so on. Rather than
spelling out every device setting by hand, you can also flip on a scene and let
that scene describe the desired end state for a whole group of devices.
Example 1: Setting Lights at Sunset
When the sun goes down, this automation drives two lamps to a warm amber at roughly two-thirds brightness.
automation:
# Push the porch and hallway lamps to amber at sunset.
triggers:
- trigger: sun
event: sunset
actions:
- action: light.turn_on
target:
entity_id:
- light.porch_lamp
- light.hallway_lamp
data:
brightness: 170
rgb_color: [255, 170, 40]
Example 2: A Notification, a Pause, Then Another
Because actions run as a script, you can chain several together and slot a
delay between them. Here a templated notification target sends one alert, the
automation waits, then sends a follow-up.
automation 2:
# Ping my phone shortly before sunset, then again afterward.
triggers:
- trigger: sun
event: sunset
offset: -00:20
variables:
alert_target: notify.maria_pixel
actions:
# The list of actions doubles as a mini script.
- action: "{{ alert_target }}"
data:
message: "Catch the sunset, it's starting!"
- delay: 0:25
- action: notify.notify
data:
message: "And that's a wrap on today's sunset."
Mixing Conditions into the Action List
Conditions aren't limited to the top-level conditions block — you can drop them
straight into the action sequence. WoowTech walks the list top to bottom, and the
moment a condition comes back false it stops, skipping everything after it.
Example 3: Evening Scene, Gated Midway
The automation fires on occupancy, always sends a heads-up notification, then checks whether it's dark enough before continuing to set the scene and switch on the lamps.
automation:
- alias: "Den evening lighting"
triggers:
- trigger: state
entity_id: binary_sensor.den_presence
to: "on"
actions:
- action: notify.notify
data:
message: "Den presence detected"
- condition: or
conditions:
- condition: numeric_state
entity_id: sun.sun
attribute: elevation
below: 6
- condition: numeric_state
entity_id: sensor.den_illuminance
below: 15
- action: scene.turn_on
target:
entity_id: scene.den_evening
- action: light.turn_on
target: "{{ {'entity_id': ['light.den_main', 'light.den_corner']} }}"
- action: switch.turn_on
target:
label_id: "{{ ['den_evening', 'den_after_dusk'] }}"
Start writing here...