Hello!
I’ve been trying to create an automation that makes use of multiple triggers and a data_template in the action. It works… sort off…
Just as a example of what I aim to achieve and put in the automation
- id: '1587965772738'
alias: Test Template
description: ''
trigger:
- entity_id: light.study_room_toilet_lights
from: 'off'
platform: state
to: 'on'
- entity_id: light.study_room_lights
from: 'off'
platform: state
to: 'on'
condition: []
action:
- data_template:
message: '{{trigger.to_state.attributes.friendly_name}} just changed from {{
trigger.from_state.state }} to {{ trigger.to_state.state }}
'
service: notify.mobile_app_iphone
- delay: 00:00:10
- data_template:
entity_id: '{{ trigger.entity_id }}'
service: light.turn_off
Now, if one of the lights is switched on, i get (as expected):
- Notification on my phone
- The light is switched off after 10s.
However, when one light is switched on and subsequently the other is switched on within 10s:
- The second light is switched off
- The first light remains on perpetually.
Is there some way that this can be done in a single automation? Or will I have to create an automation for each of the switches around?
Thanks in advance!