Need Help with Rule

NEW USER. I made this rule last night. It does turn lights and fan on when door is opened.
How do I limit this rule to stop at say midnight?
I am also wanting the lights to turn back off after I’ve been outside a minimum of 5min. The next time the door opens.

To start with, remove time from trigger and add time range to IF condition

Door changes to open
If time is between xx and yy
Light on
Fan on
Door stayed closed for 5 mins
If Door changes to open
Light off
Fan off

Something like this

Though I am not sure about ‘door is open’ part. I used to have a webcore piston to do this perfectly well. I will try this one out or maybe we have to use a variable and two rules to achieve this.

As its written now the rule will only run at 10 mins after sunset OR anytime the door opens.

You’ll need to change your rule flow.

You’ll need additional triggers
• 10 mins after sunset (only if you want the fan and light to turn on at this specific time no matter if door is opened or not)
• door changes to open
• door stays closed for 5 mins
• light stays on for 5 mins
• time is midnight

If (ALL)
Time is between (whatever time frame you want the lights to come on)
door changes to open
turn light on, turn fan on

If (ANY)
light has stayed on for 5 mins
door stayed closed for 5 mins
door changes to open
turn light off

time is after 11:59pm
turn fan off, turn light off

Thank you. I had one in webcore that worked perfectly as well. I am about to use your example

1 Like

I just made this one and it is working fine for me, but I am using a sensor as well.