In the following automation, whatever is returned for entity_id (not sure how I can see this) when I turn on one of the designated fans does not match as expected and therefore fails to start the appropriate timer. I’ve tried trigger.from_state.entity_id and trigger.to_state.entity_id, and neither of those work.
alias: Timer - start timer20
description: ''
trigger:
- platform: event
event_data:
entity_id: switch.fan_master_bath
control: DON
event_type: isy994_control
- platform: event
event_data:
entity_id: switch.fan_master_toilet
control: DON
event_type: isy994_control
- platform: event
event_data:
entity_id: switch.fan_pool_bath
control: DON
event_type: isy994_control
condition: []
action:
- service: timer.start
data:
entity_id: |
{% if (trigger.entity_id) == 'switch.fan_master_bath' %}
timer.master_bath30
{% elif (trigger.entity_id) == 'switch.fan_master_toilet' %}
timer.master_toilet30
{% elif (trigger.entity_id) == 'switch.fan_pool_bath' %}
timer.pool_bath30
{% endif %}
mode: single
Note that a similar template with a slightly different trigger works just fine:
alias: Timer - cancel timers
description: ''
trigger:
- platform: state
entity_id: switch.fan_master_bath
from: 'on'
to: 'off'
- platform: state
entity_id: switch.fan_master_toilet
from: 'on'
to: 'off'
- platform: state
entity_id: switch.fan_pool_bath
from: 'on'
to: 'off'
condition: []
action:
- service: timer.cancel
data:
entity_id: |
{% if (trigger.entity_id) == 'switch.fan_master_bath' %}
timer.master_bath20, timer.master_bath30, timer.master_bath40
{% elif (trigger.entity_id) == 'switch.fan_master_toilet' %}
timer.master_toilet20, timer.master_toilet30, timer.master_toilet40
{% elif (trigger.entity_id) == 'switch.fan_pool_bath' %}
timer.pool_bath20, timer.pool_bath30, timer.pool_bath40
{% endif %}
mode: single
Any ideas?