I have linked a Sonoff into my extractor fan as I have a hue bulb in my bathroom. (this meant that the extractor fan was on all the time due to the hue bulb being constantly powered… I digress
Want I currently have is if the light turns on and remains on for over 3.5 mins then turn on the extractor fan relay, and then then the light turns off, turn off the relay. This is fine (better than how it was) but I want to improve it.
I want to be able to delay the turn off command based on how long the light has been on. So if the light was on for a little while turn the extractor fan off as soon as the light goes off, but if the light was on for a while (aka a shower), then keep the extractor fan on for longer, say a few minutes after the light goes off.
I see there is a timer, but that counts down, ideally I want the reverse. Is there an easy way to achieve this? There may be something I am not thinking. I guess one option is to install a humidity sensor and use that as a condition, but I dont have one of those, so hoping I can do it through logic for now.
I was hoping for a turn off condition of: if light timer is 3 mins then wait 1 mins before turning off, if light timer is 5 mins then wait 5 mins before turning off.
So this works for what I want. I need to test it a few times to make sure it catches every case. But I created a timer that lasts 8 mins (may need to adjust, but I doubt I take longer than that in the shower). When the extractor fan turns on (3.5mins after the light turns on) it will start the timer. When the light turns off it will check the condition of the timer, if the timer is active (aka the light has been on for less than 8 mins) then it will turn the extractor fan off 30 seconds after the light. If the timer hits zero then the extractor fan will stay on for 4 mins after the light goes off.