Slider for my fan

Hi All,

I have 3 fans added into Home assistant.
The only option I'm missing is to turn on the fans for X hours.
For example I want turn on the fan and want to automatically turn it off after 2 hours.
I would like to have a slider with the phases 1, 2, 3, 4 hours. When the slider is at 1 it will be o for one hour, when the slider in on 2 it will be on for two hours and so on.

Could you please advice me how to solve this?

Thanks in advance

Already found a solution with a helper. Thanks all