I was thinking about setting up something similar. But I was going to do it like this -
Turn on the fan when the humidity rises above X percent - Because I don’t really care how long it took to get there. And then turn off the fan when the humidity falls below X percent.
This would probably be an easier automation to create. And is there something important about that 45 minute number? I would think you’d be more interested in running the fan until the humidity is low, regardless of how long or short of a period of time that takes.
What humidity sensor are you using? I have not purchased one yet, but am looking at Aqara.