Send SSH Commands with HA / start two or more commands with one switch

I am new to Home Assistant and just integrated all my hardware. Everything is working fine and I am happy with HA. I have some of those zigbee smart plugs and I want to turn off my raspberry pi media center with one of them.
Is it possible to create a switch macro - first sending a ssh command to my other PI for shutting it down and then switch off the plug after 30s ?

You can use the script component to run sequential tasks:

thanks!
I tried to create a switch but there are some problems.
How can I integrate the script into my switch?

For turn off my raspberry mediacenter I have this ssh command:

switch:

  • platform: command_line
    switches:
    kodi:
    command_off: “ssh [email protected] ‘sudo shutdown -h 0’”

After 30s the script should also turn off the zigbee plug “light.osram”

Switching on should only turn on the plug.

Thank you for your help!