Switch a fan on for 5 seconds and then turn off

Thank you so much for helping me!

There was a slight problem the code as the fan turning off for 5 seconds before turning on but I was able to fixed it by defining active and relayState as low.