Rule Machine for checking unlocked doors?

I'm very new to using Hubitat and I'm trying to create a rule that will do the following:

  1. Trigger at 9 pm every day
  2. Check if the front door is not locked.
  3. If it is unlocked, then lock it.

If I write it in psuedo-code:

when time is 9:00 am
do
if ( front door lock == unlocked) then
lock front door
end if

However, when I try to create the above in Rule Machine the closest I get is this:

Screen Shot 2020-07-28 at 6.54.58 PM

I'm sure how to interpret the conditional statement. Can anyone please explain what I'm doing wrong or a better way to create this rule?

Thanks.

I think it looks fine. Did it work?
I'd also maybe have the door check happen at bed time too just to be sure. If you use a mode you could trigger it with the mode change. As a secondary with a different type of trigger.

The other option would be to reverse that actions and say if door UNLOCKED then...

But I don't know if that makes any real difference.

The other thing you may want to consider is sending a message if it is unlocked at that time (or a confirmation of locking). Some people have used a contact sensor as a condition of locking, no sense of locking an open or ajar door.

Not sure if it will help your issue but you should add an "END-IF" in your actions.

Question, what is not working?
You could add below "Lock: Front Door " something for test, like Light kitchen light. or sumsuch.

1 Like

I think maybe the issue is the text in orange.

In RM after each conditional statement you will have a (T) or a (F) based on the current condition of that conditional statement and at the end of all statements you will see [TRUE] or [FALSE] based on the entire conditional action.

So for instance
IF (NOT Door locked(F) AND Door locked (T)[FALSE])

The door is locked so
NOT Door locked is false and
Door locked is true

If you AND those statements the entire statement is FALSE

You probably don't need the if statement just the "Lock:Fornt Door".
If the door is already locked and gets another command to lock it it won't do anything.

Thanks everyone for your comments, and thank you @Hasty1 for the explanation regarding the (T) and [TRUE] notations. This does help!

With my Yale locks, it will still try to lock. It might not trigger the mechanism, but it wakes up the lock, and it chimes like it just locked so I use the conditionals in all my RM's like the OP.

OP, for reference, the "NOT" in coding is just the opposite state of what the conditional is asking for.

IE:
Door Locked (locked)
NOT Door locked (unlocked)

1 Like

I am new to HE and have only used RM for a couple of days but here is how I set mine up. It is important to check for more than did the lock just lock. If the door is open, the lock will still report it was locked. Also I want to know if the door was open slightly and the lock doesn't fully lock which puts it into the "unknown" condition. There may be a better way but this is what I came up with being new to RM.

AutoLockDoor

You could move the "IF front door closed" as the first action in the rule and and add in a wait for event "front door closed" after the notification about it being open.
This would then allow the rule to continue and lock after the door is closed and also removes the need to evaluate if the door is closed in the subsequent if statements.

Okay I think I got it now. I still need to check the sensor twice but I do like this flow better. I just need to add in my Echo's for the Open and Unknown results to yell at me too. :slight_smile:

If you added in another exit rule at the end of the if door open you would limit the notifications as I'd gather if you have to physically close the door you should still be there when it locks.

Oh yes good point, thanks for the pointers! @cohoman I hope this helps and gives you some ideas as well.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.