Hi
I need help to resolve a template variable warning:
* Template variable warning: 'action_wait' is undefined when rendering '{{action_wait}}'
I already added this line after the wait trigger but that didn’t resolve the issue:
| default('none') }}
I’m also not sure about clear_notification, is this the correct use?
when nobody is responding to the notification, it should remove/clear that message.
this is how my automation looks like:
any help is appreciated
alias: Garage
description: ""
trigger:
- platform: state
entity_id:
- cover.garage_door_1
to: open
for:
hours: 1
minutes: 0
seconds: 0
condition: []
action:
- variables:
action_close: "{{ \"GARAGE_CLOSE\" ~ context.id }}"
action_wait: "{{ \"GARAGE_WAIT\" ~ context.id }}"
action_do_nothing: "{{ \"DO_NOTHING\" ~ context.id }}"
- service: notify.family
metadata: {}
data:
message: Garage is open for a hour!
data:
actions:
- action: "{{action_close}}"
title: Close it
tag: garageclose
- action: "{{action_wait}}"
title: Wait a hour
tag: garagewait
- action: "{{action_do_nothing}}"
title: Do nothing
tag: donothing
title: Garage
- wait_for_trigger:
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{action_close}}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{action_wait}}"
- platform: event
event_type: mobile_app_notification_action
event_data:
action: "{{action_do_nothing}}"
context: {}
timeout:
hours: 0
minutes: 5
seconds: 0
milliseconds: 0
- choose:
- conditions:
- condition: template
value_template: >-
{{ wait.trigger.event.data.action == action_close | default('none') }}
sequence:
- service: cover.close_cover
metadata: {}
data: {}
target:
entity_id: cover.garage_door_1
- service: notify.family
metadata: {}
data:
message: clear_notification
data:
tag: garageclose
- choose:
- conditions:
- condition: template
value_template: >-
{{ wait.trigger.event.data.action == action_wait | default('none') }}
sequence:
- service: cover.close_cover
metadata: {}
data: {}
target:
entity_id: cover.garage_door_1
- service: notify.family
metadata: {}
data:
message: clear_notification
data:
tag: garagewait
- service: notify.family
metadata: {}
data:
title: Garage
message: |
{% if wait.trigger.event.data.action == action_close %}
Garage will close now
{% elif wait.trigger.event.data.action == action_wait %}
Garage will close in a hour
{% else %}
No action taken, garage will stay open
{% endif %}
mode: single