Script for command to raise and lower timed in home assistant

Greetings for everyone and congratulations for the beautiful forum.
I need to set a rise time and a descent time for my roller shutters.
I have a RM PRO + broadlink with cloning of a remote control with keys that have the following function: I press first time: get up, press second time: stop and another key: I press first time: go down, press second time stops.
In home assistant I need to insert a script that when I press on my card it go in rise and then 20 seconds it stops. The same thing for the descent.
Can you help me?
I attach the configuration of the configuration.yaml file and the script.yaml.
With the following scripts the roller shutters move but do not stop after 20 seconds.

In configuration. yaml:

switch:
- platform: broadlink
host: 192.168.1.2
mac: '71:1D:59:HS:67:9O'
timeout: 15
switches:
tapp_su:
friendly_name: "Sort in order rise"
command_on: 'npS4NCNXXXXXXXXXXXXXXXXXAAAAA='
tapp_giu:
friendly_name: "Sort in order lower"
command_on: 'acP6MQTXXXXXXXXXXXXXXXXXAAAAA='

In script.yaml (only for rise)

'17698952821479':
alias: Time for tapparelle
sequence:
- data:
entity_id: switch.Sort in order_rise
service: switch.turn_on
- delay: 'seconds: 20'
- data:
entity_id: switch.Sort in order_rise
service: switch.turn_on

Thank you so much

Your entity ids should not have spaces or capital letters in them. Also you called the on service instead off the off service.

'17698952821479':
alias: Time for tapparelle
sequence:
- service: switch.turn_on
  entity_id: switch.sort_in_order_rise
- delay: 00:00:20
- service: switch.turn_off
  entity_id: switch.sort_in_order_rise

Hello Tom_I, thank you!!
With this script I obtain a script error.

It helps if you post the actual error message.

Try it like this:

time_for_tapparelle:
  sequence:
    - service: switch.turn_on
      entity_id: switch.sort_in_order_rise
    - delay: 00:00:20
    - service: switch.turn_off
      entity_id: switch.sort_in_order_rise

Script error againg:

2019-02-21 15:58:30 ERROR (MainThread) [homeassistant.config] Invalid config for [script]: expected a dictionary for dictionary value @ data['script']['17698952821479']. Got None. (See C:\Users\utente\AppData\Roaming\.homeassistant\configuration.yaml, line 93). Please check the docs at https://home-assistant.io/components/script/
2019-02-21 15:58:30 ERROR (MainThread) [homeassistant.setup] Setup failed for script: Invalid config.

@ tom_I
Can you help me?

Yes, see my post above that does not start with ‘17698952821479’.

Many thanks for your courtesy … I am still new to this domotic world.
I have seen that the script works because if I go in “states” to the entry concerning the script, moving the slide to the right in ON, it returns to OFF automatically after the seconds that I set for delay (all this only at the interface level).
So I think that I commit some gross error in the creation of the card. To start the button, I press the lit arrow.
I think the card must be created in another way. I create it using the entity button or entities but I think it’s wrong.
Can you help me create the card correctly?