Contact sensors and lighting rules

I wanted to add an automation rule where if the front door was opened (contact sensor in place) that it would turn on hallway lights for 5 minutes only IF the lights were initially off AND at a certain time of day. However if they were already on, it would just stay on (nothing happens).

Thanks!

Rule Machine can do this. You'll want something like the following:

Required Expression: Time of Day
Trigger: Contact Sensor open
Actions: If light is off, turn on light
Wait for Event: Elapsed Time 5 minutes
Turn off light (assuming this is what you want to happen after 5 minutes)
End-If

Basically, this rule will only run during the time period. From there, when the contact sensor opens, it will check if the light is off. If it is on, it will do nothing. If it is off, then it will turn on the light, wait for 5 minutes, then turn off the light.

Oh thank you. I realized i was using the basic rules app and that had limitations. If i used the rule machine app i can create this.

Thank you

You can use Basic Rules, it's just formatted a little bit differently.

Trigger: Contact sensor opens
Actions: turn on light
Then wait until: Elasped time 5 minutes
Turn off light

Restrictions: Light is off and Time of Day

It works the same way as Rule Machine.

I would allow the rule to reset the five minute timer if the front door is reopened. Here's an option for RM

Required Expression
Time between Sunset and Sunrise AND
Light is off

Trigger Events
Front Door contact open

Actions to Run
On: Light
Wait for event: Front Door contact closed and stays that way for: 0:05:00
Off: Light
2 Likes