I hope, the general “configuration” category is okay for my question - if not, please give me a hint, where it should be placed
Yesterday I’ve started with my first scripted template and after some trial&error, copying and testing the stuff, it’s working now.
Unfortunantely I have some problems in understanding the yaml config:
My covers.yaml
- platform: template
covers:
garagedoor:
friendly_name: 'Garage Door'
value_template: >
# Why I need to use the character sequences {%- and -%} at each start and beginning?
# in general: Why I need to use the following line and why it is not scripted in the same way as it's used within the icon_template part?
{%- if states.binary_sensor.garagedoor_open_close_z -%}
{{ states.binary_sensor.garagedoor_open_close_z.state == 'on' }}
{%- else -%}
true
{%- endif -%}
open_cover:
service: switch.turn_on
entity_id: switch.garage_bbc8_switch_0
close_cover:
service: switch.turn_on
entity_id: switch.garage_bbc8_switch_0
icon_template: >
{%- if states.binary_sensor.garagedoor_open_close_z.state == 'on' -%}
mdi:garage-open
{%- else -%}
mdi:garage
{%- endif -%}
I’ve already check the documentation, but I haven’t found the needed information.
Can anyone give me some additional information about the question provided as the comments?
Thanks