I use the below app to handle the fans in all the bathrooms in the house. I did edit line 183 in the app code after install to change "minHumidity" to "maxHumidity" so that the fans would kick off once humidity got below the top end of the range.
From there, the RM becomes much simpler where you only need actions to handle the lights and turning things off. You can have the above app create a child device and just turn that off when heading to bed to kill the fan earlier.