I fail to invert/correct my shutter position

As HA asked me to use the new template-syntax I tried to do so. But it’s not working.

I already tried a lot, even with the help of ChatGPT & Co. but it’s still not working.

I try to invert my tuja-shutter as it is always showing the wrong position.

The ID of the device is “cover.rollladen_terrasse” and that is what I copied into my configuration.yaml:

template:
- cover:
  - unique_id: cover.rollladen_terrasse_inv
    device_class: blind
    open_cover:
    - target:
        entity_id:
        - cover.rollladen_terrasse
      action: cover.close_cover
    close_cover:
    - target:
        entity_id:
        - cover.rollladen_terrasse
      action: cover.open_cover
    stop_cover:
    - target:
        entity_id:
        - cover.rollladen_terrasse
      action: cover.stop_cover
    default_entity_id: cover.terrasse_rollladen_invertiert
    name: Terrasse Rollladen (inv.)
    state: "{% if states('cover.rollladen_terrasse') == 'open' %}\n  closed\n{% else
      %}\n  open\n{% endif %}"
    position: '{% set pos = state_attr(''cover.rollladen_terrasse'', ''current_position'')
      | int %} {{ 100 - pos }}'

But after restart, I do not even find a template or entity called “Terrasse Rollladen (inv.)”

Can somebody help me, please?

I have exactly the same problem.
It seems that Home Assistant support has asked the Tuya code manager to intervene: there’s been no response yet.