Run a script

So,
I installed my raspberry pi 4 and everything working fine!
I can bind all the sensors I got, switches, rollers, door sensors, and even created some nice rules.
My question is - how do I create scripts and run those scripts by button trigger?
I would like for example to create a button that will trigger the kitchen light to turn on and after 30 seconds will go off.
from where to begin?

Thanks for the help.

Search for the expire binding.