Automate roller shutter - Close it for X seconds

Hi, I recently added some LoraTap wifi modules in order to control my roller shutters. It works fine via Tuya app and Home Assistant as well. The thing is, I would like to automate them when a Xiaomi Light sensor gets a certain maount of lux and close them but not entirely, but keep them almost “ajar”

I can roll them, unroll them completely, and pause them, but the module doesn’t allow rolling/unrolling them at a certain position, so I thought to keep closing them a certain amount of seconds (21 in my case) and then stop it, but it seems that the script doesn’t continue to the Stop statement until it finishes unrolling completely the shutter.

Any ideas of how could I accomplish this? The Script GUI generated this YAML:

bajar_persianas_casi_hasta_abajo:
  alias: Bajar persianas casi hasta abajo
  sequence:
  - device_id: e7bb0ba737d06063a87b4b43e73869ef
    domain: cover
    entity_id: cover.0005081570039f8c3b80
    type: close
   - wait_template: '21'
  - device_id: e7bb0ba737d06063a87b4b43e73869ef
    domain: cover
    entity_id: cover.0005081570039f8c3b80
    type: stop
  mode: parallel
  max: 10

What integration are you using for the cover?

Likely, the integration is “synchronous” and won’t return until the shutters are actually closed, so there is probably no easy solution…

It’s a Wi-Fi module linked via Tuya integration

I’m trying calling services but it’s happening the same

bajar_persianas_casi_hasta_abajo:
  alias: Bajar persianas casi hasta abajo
  sequence:
  - service: cover.close_cover
    target:
      entity_id:
      - cover.0005081570039f8c3aff
      - cover.0005081570039f8c3b80
      - cover.50107307e09806cc31a5
  - wait_template: '21'
    continue_on_timeout: true
  - service: cover.stop_cover
    target:
      entity_id:
      - cover.0005081570039f8c3aff
      - cover.0005081570039f8c3b80
      - cover.50107307e09806cc31a5
  mode: parallel
  max: 10

Ah, you want delay, here. wait_template expects true/false.
And be careful about alignement, ofc

Thank you! I realised by myself minutes after posting. This did the thing:

bajar_persianas_casi_hasta_abajo:
  alias: Bajar persianas casi hasta abajo
  sequence:
  - service: cover.close_cover
    target:
      entity_id:
      - cover.0005081570039f8c3aff
      - cover.0005081570039f8c3b80
      - cover.50107307e09806cc31a5
  - delay:
      hours: 0
      minutes: 0
      seconds: 20
      milliseconds: 0
  - service: cover.stop_cover
    target:
      entity_id:
      - cover.0005081570039f8c3aff
      - cover.0005081570039f8c3b80
      - cover.50107307e09806cc31a5
  mode: parallel
  max: 10