I have tried to use variables in a blueprint to import the inputs of the blueprint into a template. But the configurator doesn’t recognize the command and comes with a unknown tag error… I cant set a variable as !input. I hope someone can help
I have also tried pasting variables !input from other blueprints into my blueprint and they dont get recognized either.
The errormessage:
unknown tag !<!input> at line 27, column 56:
… t: !input string_aktuel_setpunkt
Here is my blueprint:
blueprint:
name: set temp in HA for IHC varmestyring
description: Uses a input_number to set the temperatur in the IHC varmestyring funktionsblok
domain: automation
input:
input_number:
name: temp
selector:
entity:
domain:
input_number
string_aktuel_setpunkt:
name: ID aktuel setpunkt
selector:
number:
min: 0
max: 9999999999
mode: box
string_setpunkt_normal:
name: ID Setpunkt normal
selector:
number:
min: 0
max: 999999999
mode: box
variables:
string_aktuel_setpunkt: !input string_aktuel_setpunkt
string_setpunkt_normal: !input string_setpunkt_normal
input_number: '{{states("{{ !input input_number }}")}}'
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: input! input_number
action:
# set aktuel setpunkt
- service: ihc.set_runtime_value_float
data_template:
ihc_id: "{{ string_aktuel_setpunkt }}"
value: '{{states("{{ input_number }}") | float}}'
# set setpunkt normal
- service: ihc.set_runtime_value_float
data_template:
ihc_id: "{{ string_setpunkt_normal }}"
value: '{{ "{{ input_number }}" | float}}'
mode: single
So I was getting a similar error from another blueprint and what I found that worked for me was to remove the !input in front of your variable. After that I saved it, reloaded my automations and tested and it fired off exactly as I was expecting it to.
action:
domain: mobile_app
type: notify
device_id: !input notify_device
message: “{{ trigger.event.data.new_state.attributes.friendly_name }} has deteced a leak.”
title: “Leak detected!”
changed to:
action:
domain: mobile_app
type: notify
device_id: notify_device
message: “{{ trigger.event.data.new_state.attributes.friendly_name }} has deteced a leak.”
title: “Leak detected!”
Don’t know if this will fix it for you but worth a shot.
The solution is - dont get distracted by the configurator saying the variables !input is a unknown tag. as it does work. I found out that you can go in to the automations menu in the configurationenu and tap on the
all the way to the left of the automation, on this page you can see if the information is passed on through your automation. Very nice feature.
I also had a problem with the input_number not being seen as the trigger entity. But everything is working now
blueprint:
name: set temp in HA for IHC varmestyring V3
description: Uses a input_number to set the temperatur in the IHC varmestyring funktionsblok
domain: automation
input:
input_number:
name: temp
selector:
entity:
domain:
input_number
aktuel_setpunkt:
name: ID aktuel setpunkt
selector:
number:
min: 0
max: 9999999999
mode: box
setpunkt_normal:
name: ID Setpunkt normal
selector:
number:
min: 0
max: 999999999
mode: box
variables:
aktuel_setpunkt_id: !input aktuel_setpunkt
setpunkt_normal_id : !input setpunkt_normal
_input_number: !input input_number
input_temp : '{{ states(_input_number) | float }}'
trigger:
- platform: event
event_type: state_changed
event_data:
entity_id: !input input_number
action:
# set aktuel setpunkt
- service: ihc.set_runtime_value_float
data_template:
ihc_id: "{{ aktuel_setpunkt_id }}"
value: "{{ input_temp }}"
# set setpunkt normal
- service: ihc.set_runtime_value_float
data_template:
ihc_id: "{{ setpunkt_normal_id }}"
value: "{{ input_temp }}"
mode: single
Everything between the {{ ... }} is meant for the Jinja2 interpreter, not for the YAML processor. In addition, it was an invalid template because you cannot nest templates.
That’s why the documentation states inputs are YAML tags and nottemplate variables. It continues to explain you first need to assign the input to a script variable and then you can reference the script variable in the template.
Which is what wizbang suggested (and deserves to be marked as the Solution post because it was first to offer the correct solution):
I will set him as the solution, but that was not my first problem, the first problem was that the configurator said that
variables:
some_var: !input my_var
had an unknown tag ( !input) in the variables section, but that just seems to be an error in the configurator. Because even after it is working it still says there is a problem. This was the first problem I tried to fix, if I knew that it actually wasn’t an error I could have continued and found the other problem. But I will let him have the solution
It is a little odd, now I have exported the blueprint to another Home Assistant installation and this says there are no issues… I am setting up Home Assistant multiple places, so I dont have the Home Assistant installation where I made the blueprint at hand right now.
But I will send a picture later. Maybe it is because it isn’t running the latest version
The File Editor Add-on is independent of Home Assistant. My guess is whatever rules it uses to check YAML syntax probably haven’t been updated.
The real deal is Developer Tools > Server Controls > Check Configuration. If it spots an error, Home Assistant is likely to refuse to load the defective configuration until the error is corrected.