Alexa: Problem with roller shutters

I use this: https://github.com/AlexxIT/SonoffLAN
I installed it via HACS

Well, your problem is that you do not have the attribute position, which defines the position of the cover. Either your cover physically doesn’t support a position, or that custom repo that you’re using isn’t setting up cover properly.

Your only recourse to get the utterances to work is:

  1. create a template cover that implements position_template and set_position and expose that to alexa
  2. Have the creator of SonoffLAN fix his integration (if it’s a bug, unclear on that without looking at his code).

By your first option, do you mean this?

cover:
  - platform: template
    covers:
      tapprella_cucina:
        device_class: tapparella
        friendly_name: "Tapparella cucina"
        value_template: "{{ states('sensor.garage_door')|float > 0 }}"  (here would there be something that reads the position of the shutter?)
        open_cover:
          service: script.tapparella_cucina_aperta
        close_cover:
          service: script.tapparella_cucina_chiusa
        stop_cover:
          service: script.tapparella_cucina_ferma

I got it from here: Template Cover - Home Assistant

the most concise way to make this work…

Add a input number through the UI or in yaml. Make the range 0 to 100. Name it Tapparella cucina
then…

cover:
  - platform: template
    covers:
      tapprella_cucina:
        device_class: tapparella
        friendly_name: "Tapparella cucina"
        position_template: "{{ states('input_number.tapparella_cucina') | int(0) > 0 }}"
        set_cover_position:
        - service: >
            {% if position == 0 %}
              script.tapparella_cucina_chiusa
            {% if position == 100 %}
              script.tapparella_cucina_aperta
            {% else %}
              script.tapparella_cucina_ferma
            {% endif %}
        - service: input_number.set_value
          data:
            value: "{{ position }}"
        open_cover:
        - service: script.tapparella_cucina_aperta
        - service: input_number.set_value
          data:
            value: 100
        close_cover:
        - service: script.tapparella_cucina_chiusa
        - service: input_number.set_value
          data:
            value: 0
        stop_cover:
        - service: script.tapparella_cucina_ferma
        - service: input_number.set_value
          data:
            value: 50

keep in mind, this attempts to keep the input_number in sync with the garage state. If you restart home assistant and it’s reversed, you’ll get odd behavior. But this is the only way to enable the utterances for raise and lower.

The other option is to use your other cover as the position state. Is it the cover listed above? If yes…

cover:
  - platform: template
    covers:
      tapprella_cucina:
        device_class: tapparella
        friendly_name: "Tapparella cucina"
        position_template: "{{ 100 if is_state('cover.sonoff_10012b8b18', 'on') else 0 }}"
        set_cover_position:
        - service: cover.{{ 'open' if position > 0 else 'close' }}_cover
          target:
            entity_id: cover.sonoff_10012b8b18
        open_cover:
        - service: cover.open_cover
          target:
            entity_id: cover.sonoff_10012b8b18
        close_cover:
        - service: cover.close_cover
          target:
            entity_id: cover.sonoff_10012b8b18
        stop_cover:
        - service: cover.stop_cover
          target:
            entity_id: cover.sonoff_10012b8b18

Ok, I put:

input_number:
  slider1:
    name: Tapparella cucina
    min: 0
    max: 100
cover:
  - platform: template
    covers:
      tapprella_cucina:
        device_class: tapparella
        friendly_name: "Tapparella cucina"
        position_template: "{{ states('input_number.tapparella_cucina') | int(0) > 0 }}"
        set_cover_position:
        - service: >
            {% if position == 0 %}
              script.tapparella_cucina_chiusa
            {% if position == 100 %}
              script.tapparella_cucina_aperta
            {% else %}
              script.tapparella_cucina_ferma
            {% endif %}
        - service: input_number.set_value
          data:
            value: "{{ position }}"
        open_cover:
        - service: script.tapparella_cucina_aperta
        - service: input_number.set_value
          data:
            value: 100
        close_cover:
        - service: script.tapparella_cucina_chiusa
        - service: input_number.set_value
          data:
            value: 0
        stop_cover:
        - service: script.tapparella_cucina_ferma
        - service: input_number.set_value
          data:
            value: 50

But putting your code gives me this error:

Invalid config for [cover.template]: Service {% if position == 0 %}
script.tapparella_cucina_chiusa
{% if position == 100 %}
script.tapparella_cucina_aperta
{% else %}
script.tapparella_cucina_ferma
{% endif %}
does not match format <domain>.<name> for dictionary value @ data['covers']['tapprella_cucina']['set_cover_position'][0]['service']. Got '{% if position == 0 %}\n script.tapparella_cucina_chiusa\n{% if position == 100 %}\n script.tapparella_cucina_aperta\n{% else %}\n script.tapparella_cucina_ferma\n{% endif %}\n'
expected CoverDeviceClass for dictionary value @ data['covers']['tapprella_cucina']['device_class']. Got 'tapparella'. (See ?, line ?).

Even with the other you wrote it gives me an error.