Beginner: configuration.yaml error when adding a template

Hi,

When adding a template I’m getting the following error.

Failed to reload configuration

Cannot quick reload all YAML configurations because the configuration is not valid: Error loading /config/configuration.yaml: while parsing a block mapping in “/config/configuration.yaml”, line 3, column 1 expected , but found ‘-’ in “/config/configuration.yaml”, line 23, column 1

YAML below - IP removed from post


# Loads default set of integrations. Do not remove.
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes

#Themes
frontend:
    themes: !include_dir_merge_named themes
    
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 0.0.0.0/24
    
#reverse
- platform: template
  covers:
    cover.wifi_curtain_motor_curtain_reversed:
      friendly_name: wifi_curtain_motor_curtain_reversed
      position_template: "{{ 100 - state_attr('cover.wifi_curtain_motor_curtain',
        'current_position') | int(100) }}"
      open_cover:
        service: cover.close_cover
        data: {}
        target:
          entity_id: cover.wifi_curtain_motor_curtain
      close_cover:
        service: cover.open_cover
        data: {}
        target:
          entity_id: cover.wifi_curtain_motor_curtain
      stop_cover:
        service: cover.stop_cover
        data: {}
        target:
          entity_id: cover.wifi_curtain_motor_curtain
      set_cover_position:
        service: cover.set_cover_position
        data:
          position: "{{100-position}}"
          entity_id: cover.wifi_curtain_motor_curtain
      icon_template: |-
        {% if is_state('cover.wifi_curtain_motor_curtain', 'closed') %}
          mdi:blinds-open
        {% else %}
          mdi:blinds
        {% endif %}

Any help would be greatly appreciated.

Thanks.

You are missing the top-level key cover as shown in the example in the Template Cover docs.

1 Like