HA dashboard switch that makes many actions with timer

I have an ESP8266 module with a relay with a pre-installed tasmota. The relay is connected to the pulse input in the gate controller. I have set in the tasmota that switching the switch triggers a 500ms pulse. The switch.gate entity appeared in Home Assistant and I put it on the dashboard and basically everything works.

Now I would like to press the switch (maybe virtual) on the HA dashboard to turn on the light in front of the gate, open the gate and turn off the light after 10 minutes.
It would be nice if the light turned off 10 minutes after the last click on the switch (e.g. we open the gate, stop it, close it and open it again, the lamp will turn off only 10 minutes after the last action).

How to do it?