mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-19 15:26:59 +00:00
Added example (#7469)
Added an additional tested and working example of how to use a trigger variable in an automation.
This commit is contained in:
parent
e41b7cf495
commit
62bc9ab668
@ -37,6 +37,31 @@ automation 2:
|
||||
notify.{{ trigger.topic.split('/')[-1] }}
|
||||
data_template:
|
||||
message: '{{ trigger.payload }}'
|
||||
|
||||
automation 3:
|
||||
trigger:
|
||||
# Multiple Entities for which you want to perform the same action.
|
||||
- platform: state
|
||||
entity_id:
|
||||
- light.bedroom_closet
|
||||
to: 'on'
|
||||
# Trigger when someone leaves the closet light on for 10 minutes.
|
||||
for: '00:10:00'
|
||||
- platform: state
|
||||
entity_id:
|
||||
- light.kiddos_closet
|
||||
to: 'on'
|
||||
for: '00:10:00'
|
||||
- platform: state
|
||||
entity_id:
|
||||
- light.linen_closet
|
||||
to: 'on'
|
||||
for: '00:10:00'
|
||||
action:
|
||||
- service: light.turn_off
|
||||
data_template:
|
||||
# Whichever entity triggers the automation we want to turn off THAT entity, not the others.
|
||||
entity_id: "{{ trigger.entity_id }}"
|
||||
```
|
||||
{% endraw %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user