I created a little simple blueprint to show what i mean:
blueprint:
name: 'Test Template Trigger for:'
description: 'Test if for option accepts variables'
domain: automation
input:
duration:
name: Duration
default:
hours: 0
minutes: 0
seconds: 15
selector:
duration:
enable_day: false
trigger_variables:
tv_duration: !input duration
tvd_seconds: "{{tv_duration.seconds}}"
tvd_minutes: "{{tv_duration.minutes}}"
tvd_hours: "{{tv_duration.hours}}"
variables:
v_duration: !input duration
vd_seconds: "{{v_duration.seconds}}"
vd_minutes: "{{v_duration.minutes}}"
vd_hours: "{{v_duration.hours}}"
trigger:
- platform: template
id: diff
# every 5 minutes: 43,48,53,58,3,8,...
value_template: >
{{now().minute % 5 > 2}}
for:
hours: 0
minutes: 0
seconds: 15
# Error when using: 'seconds: "{{vd_seconds}}" ' or 'seconds: "{{tvd_seconds}}" '
#
# Template variable warning: 'vd_seconds' is undefined when rendering '{{vd_seconds}}'
action:
- service: notify.persistent_notification
metadata: {}
data:
message: >
Tijd: {{now()}} {{"\n"}}
minute: {{now().minute}} {{"\n"}}
tv_duration: {{tv_duration}} {{"\n"}}
tvd_seconds: {{tvd_seconds}} {{"\n"}}
tvd_minutes: {{tvd_minutes}} {{"\n"}}
tvd_hours: {{tvd_hours}} {{"\n"}}
v_duration: {{v_duration}} {{"\n"}}
vd_seconds: {{vd_seconds}} {{"\n"}}
vd_minutes: {{vd_minutes}} {{"\n"}}
vd_hours: {{vd_hours}} {{"\n"}}
mode: single
Goal here is to check whether the trigger reason last for a defined time. This time has to be a blueprint input, but I tried everything, created trigger_variables and normal variables to put into the ‘for:’ setting, nothing works, only constants.
When running the blueprint as uploaded here, all works OK. but when changing one of the for-arguments into a row with a variable:
seconds: "{{vd_seconds}}"
… a error is thrown :
Template variable warning: 'vd_seconds' is undefined when rendering '{{vd_seconds}}' ')
… in the system-logs.
Running/testing the automation manually (so without the trigger) runs OK, showing that all variables exists.
What am I doing / is going wrong here? Or is using a variable in this ‘for:’ setting just not possible?