Whats wrong with my template switch it shows off even when light is on

so i know i have homeassistant sometimes flashing my basement lights i wondering if my 2 switchs i have it setup wrong

    ### Basement Lights ###
    - switch:
        - turn_on:
            - action: switch.turn_on
              target:
                entity_id:
                  - switch.basement_lights
          turn_off:
            - action: switch.turn_off
              target:
                entity_id:
                  - switch.basement_lights
          default_entity_id: switch.basement_lights
          name: Basement Lights
          state: "{{ is_state('switch.basement_lights_3way', 'on') }}"


    ### Basement Center Light ###

    - switch:
        - turn_on:
            - action: light.turn_on
              target:
                entity_id:
                  - light.basement_middle_light
          turn_off:
            - action: light.turn_off
              target:
                entity_id:
                  - light.basement_middle_light
          default_entity_id: switch.basement_center_light
          name: Basement Center Light
          state: "{{ is_state('light.basement_middle_light', 'on') }}"


now i know i have 2 different ways i configured it so one of them has to be wrong i not sure what one is correct

the physical switchs with the original name is

switch.basement_lights_3way
light.basement_middle_light

so i not sure the correct way

You're not using the physical entities in your actions — you're referencing the template switch entity of itself (what you have in the default entity ID). Use the entity IDs you have in the state templates.

Use switch.basement_lights_3way there, for example.

@parautenbach oh ok so i need to use the real switch name there.. is the state: part correct you want it under the real switch name too

so i guess i did the basement middle light right just not the 3way correct

as i had weird issues where the light would turn on and off on its own.. like ghosts so i guessing that was the problem then

Before we go on: why did you create the template switches? Is it simply to have nice looking entities? Do you know you can change the entity ID? You can also apply a special setting to a switch to display it as a light.

Yes and yes, but there's a subtlety here: The way you have it will work fine, but will never show your template switch as unavailable when the physical one becomes unavailable. If you want to mirror the state exactly, use the states function instead, but then there's really no difference between this and the original, which then begs my question above.