Template condition that work in a automation but not in a blueprint

Hello, I’ve created an automation to turn a sonoff wall switch into a cover switch.
Since I have several shutters I created a blueprint. Everything works ok with the exception of the template conditions. In the original automation the template conditions works ok, but when I put it in the blueprint this conditions are not assumed.

This is the code of the automation were it works ok:

  - if:
      - condition: trigger
        id: "1"
      - condition: template
        value_template: "{{ (state_attr('cover.persiana_wc', 'current_position')|int) == 100 }}"
    then:
      - service: cover.stop_cover
        data: {}
        target:
          entity_id: cover.persiana_wc

This is the code of the blueprint (where this condition is ignored):

  - if:
      - condition: trigger
        id: "1"
      - condition: template
        value_template: "{{ (state_attr('!input cover_persiana', 'current_position')|int) == 100 }}"
    then:
      - service: cover.stop_cover
        data: {}
        target:
          entity_id: !input cover_persiana

I would like to have this condition working in the blueprint. Does anyone has a sugestion?

I think what you do is this. First define a variable

variables:
  cover_entity: !input cover_persiana

Then use this variable in your template condition


value_template: "{{ (state_attr(cover_entity, 'current_position')|int) == 100 }}"

1 Like

It solved the issue

Thank you