Finally got around to trying this out. I’m getting an error stating “Error rendering data template: UndefinedError: ‘triggered’ is undefined”. I’m pretty sure it’s referring to the trigger on the door1_notifier automation but I can’t figure out the issue.
FYI, no difference if I manually toggle the boolean or let the door sensor toggle it.
- id: door1_open
alias: 'Door 1 is open'
trigger:
platform: state
entity_id: sensor.door1
to: 'Open'
for:
minutes: 1
condition: []
action:
- service: input_boolean.turn_on
entity_id: input_boolean.door1_left_open
- id: door1_closed
alias: 'Door 1 is closed'
trigger:
platform: state
entity_id: sensor.door1
to: 'Closed'
condition:
condition: state
entity_id: input_boolean.door1_left_open
state: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.door1_left_open
- id: door1_notifier
alias: 'Door 1 Notifier'
trigger:
platform: state
entity_id: input_boolean.door1_left_open
condition: []
action:
- service: notify.door_notify
data_template:
title: "{{ 'Door1 left open!' if triggered.to_state.state == 'on' else 'Door1 closed' }}"
message: >-
{% if triggered.to_state.state == 'on' %}
Door1 has been open since {{states.zwave.ecolink_door_window_sensor.attributes.receivedTS}}.
{% else %}
Door1 was closed at {{states.zwave.ecolink_door_window_sensor.attributes.receivedTS}}.
{% endif %}