Door unlocked at night

I'm trying setup a rule that will turn on a light at night if either of my locks are unlocked. I only want it to run during certain modes. I'm trying to figure out the best way to trigger the rule. I can do it when the mode becomes night but if the door is unlocked after the mode changes I won't know about it. I could do it on a periodic schedule for every 15 mins but I'm not sure how to limit that to only night mode. Don't want all that noise on my network, Thanks for the help.

There are a few things you could be trying to do here that aren't yet clear, but in the purest reading of your request, I think you could essentially start your actions with a restriction of sorts, like,

If time is not between xx:xx and xx:xx, exit rule.

So... You could set time becomes x as a trigger and lock changes as another trigger...

Then say the above about exiting the rule.

Then simply have your conditional statements after, basically,

If the lock is unlocked, turn on the light.

Put it all together:

Triggers:
Time becomes xx:xx
Lock changes

If time is not between xx:xx and xx:xx, exit rule
Else if
Lock is unlocked, turn on light

If I'm thinking straight, this will turn on your light at the beginning of the time if your life is already unlocked. But it will also turn on the light later if, during the time range, the lock becomes unlocked.
It's simple because that one conditional action "if lock is unlocked, truth on the light" could be triggered by EITHER trigger. The time trigger would be true and make the first "if" statement false, moving on to the else-if, turning on the light.
Or the lock trigger would be true and turn on the light, but only IF the time range was right (otherwise it would stop running the rule before it got there).

Now, adding stuff in to turn the light off would be simple enough, but I think the above logic covers turning it on how you want.

Edit: I see you specifically mentioned modes, but I was more just answering about "at night," because you mentioned a hesitance to use modes. But the same kind of logic could apply. For that matter, I think you could just use a some lighting app for this? Or mode lighting? Anyway, hopefully there was something in there useful to at least think about.

If you want to go that route, you could do something like this:

Here's a simple automation one (i.e. NOT Rule Machine) that would do it when the door is unlocked. I don't think it would turn the light on at nighttime if the door was already unlocked, but you could easily create another some automation to handle that part.

Question:
I have 3 locks. They all lock after they've been closed for 30 seconds as long as the conditions have been met. If the locks are that easy to control, and they have a keypad, then why not just set up a rule to lock them if everything is closed after a certain period of time? My locks don't lock if the door is open, or a corresponding door is open. So if my garage OH door is open, then the walk door doesn't lock. If that's not locked, then the entry door doesn't lock. Once closed then they lock. I have locks and contacts set in HSM so if we go to bed and a door/contact/ lock shows open, then it tells me. Is this an unreasonable use case? If you set up a regular check, then you're right, you cause unnecessary traffic. So, I was just curious about it and don't want to sound like I'm picking. Everyone has their use case. Everything is unique.
Oh and I have it so that if certain codes unlock the garage door, the inside door unlocks as well, so you're not having to hit the codes on each lock. Very nice feature to use if I might add.

1 Like

That sounds like great solution but the issue is that door are a bit stick so if they are not push when locked the lock could have issue. For now I just wanted the notification so that before I goto bed if I see the light on I know one of my doors is unlock. We are going to replace the doors in the future so i might use your logic then.

thanks

1 Like

Oh makes sense. Like I said, each use case is different, so I was curious. If you have a contact sensor and you place it so it triggers only when the door is completely closed tight (there's some slosh because it's a magnet) I think this is very, very possible. I'll be watching to see what you come up with.