Auto turn off after x time

I want to make one of my IKEA remotes turn on the shower lights and a vent. I have the remote and i could probably connect both the vent and lights to an IKEA outlet. But how would i make the lights and vent turn off automatically after e.g. one hour after they have been turned on ?

I guess it could be done with some script, or automation, but not sure what is the best approach

make an automation that triggers off the fan turning on. The action should be a duration of 1 hour then a turn off service.

Bonus:

Take the actions and place them into a script. Then cancel (script.turn_off) the script if you turn the fan off early. Also, change your action to turn off the script then turn it back on. So that you don’t get n+ timers each time you turn on and off the fan.