Noob Questions on Automations

I am trying to setup a few automations for the following:

  • ST is setup where both my wife and my iphones are setup for presence detection
  • When we are both not at home, my garage entry door with a Schlage Connect lock locks (automation works fine, no screenshot attached)
  • When either of us comes home, that same door unlocks (first screenshot below)
  • At 11pm, regardless of presence, I want the door to lock automatically if it is unlocked. If the door is unlocked for some reason after 11pm, it should re-lock after 10 mins (second screenshot below).

The automation works fine if the door is unlocked after 11pm and will re-lock after 10 mins. However, if the door is unlocked prior to 11pm, it will not lock at 11pm. I have to remove the “10 min lock state” criteria to resolve this, but it will then not re-lock after 10 mins.

How do I modify the automation to do both? In summary, I want the unlock automation to run 24 hours a day when one of us comes home and the door is locked. At 11pm, the door locks automatically, however, if someone comes home after 11 and it’s locked, the door will unlock automatically for the person and then re-lock after 10 mins.

In the first routine change phone presence to: At home after being away for x minutes

In the second routine remove the time period under the if part and add it to the then part of the routine

There has to be an event to trigger a Routine.

As your second one is written, the lock would have to change from locked to unlocked and stay unlocked for 10 minutes during the hours in the precondition for the Routine to be triggered.

1 Like

You can’t really do what you are asking in a single routine (might be possible in the Smartlighting app but wouldn’t run local).

If you want the door to lock every night at 11 pm, put that in a routine.

To handle the second part, I’d do this:

“No-one home” (precondition)
“Door is locked” (precondition)
“Between 11pm and 6am” (precondition)
Door is unlocked (trigger)
Lock Door after 10 mins

In general, preconditions check the state of a device/mode/etc and the trigger is a change of state that initiates the routine. Sometimes it’s not possible to check the state directly when you want something like between a relative time and specific time (10 pm to Sunrise). In that case, folks have been using virtual switches as “variables” to represent when that state is on/off (it’s nighttime or not). Also, people have been using precondition state checks in combination with virtual switches/buttons to recheck state at interval to initiate an action like check if door is open every 15 mins and send a notification if it is.

1 Like

If I’m understanding this correctly, this logic won’t lock my door at 11pm if we are both home though. Correct? Hence, it really sounds like I need to have 3 separate automations.

  1. I can keep my first one above which unlocks the doors if either of us arrives home and the door is locked. This is helpful if, for example, during the daytime, if one of my kids locks the door while home with my wife, and I come home, it will unlock the door for me when I arrive.
  2. My second one above will monitor for any door unlocks that happen after 11pm, and if it does, it will lock the door after 10 minutes.
  3. I create a new automation which locks the door at 11pm every night.

Would those work? Appreciate the help! :smiley:

1 Like