Help with Template Switches

Hello,

I’m hoping someone can help me understand what I’m doing wrong with a Switch Template I’m trying to create. Here is my YAML:

template:
  - switches:
    - garage_door_controller1:
        name: "Garage Door Controller 1"
        default_entity_id: garage_door_controller1
        value_template: "{{ is_state('cover.garage_door_controller1', 'open') }}"
        turn_on:
          service: cover.open_cover
          entity_id: cover.garage_door_controller1
        turn_off:
          service: cover.close_cover
          entity_id: cover.garage_door_controller1

After a restart, I am going to Developer Tools → States and the entity doesn’t show up. What am I doing wrong?

TIA

The example you posted is not following the structure described in the documentation for the Template Switch integration.

Specifically, these two lines are invalid.

  - switches:
    - garage_door_controller1:

Try this version.

template:
  - switch:
      - name: "Garage Door Controller 1"
        default_entity_id: garage_door_controller1
        state: "{{ is_state('cover.garage_door_controller1', 'open') }}"
        turn_on:
          service: cover.open_cover
          entity_id: cover.garage_door_controller1
        turn_off:
          service: cover.close_cover
          entity_id: cover.garage_door_controller1

That line is also invalid, it needs a full entity ID:

default_entity_id: switch.garage_door_controller1

Template - Common Configuration Options

template:
  - switch:
      - name: "Garage Door Controller 1"
        default_entity_id: switch.garage_door_controller1
        state: "{{ is_state('cover.garage_door_controller1', 'open') }}"
        turn_on:
          - action: cover.open_cover
            target:
              entity_id: cover.garage_door_controller1
        turn_off:
          - action: cover.close_cover
            target:
              entity_id: cover.garage_door_controller1