Control Front Door Sensor AND Lock by Time


#1

I have a piston that had been working fine (95% of the time at least) prior to adding a Konnected device to my security system and getting access to countless sensors around the house. I decided I wanted to address a small issue I was having. The basic idea is that, if it’s daytime and the door lock state changes to Unlocked, then wait 30 minutes (I’m likely home and working on the yard or some such) and then lock the door. If it’s night then wait just two minutes and then lock the door. The complication happens when a visitor shows up at night and you get the long hello or good-bye at the door. Two minutes expires and the deadbolt locks with the door open. So, now that I have door sensor access I wanted to add a check to verify first that the door is indeed closed before locking the lock.

Some of the time this is working just fine. At other times the door sensor SEEMS to be claiming the door is open when it’s clearly closed. However, outside of this window of time, all testing never shows a time when the sensor is wrong.

That has me wondering if my piston is doing something odd that’s mixing up the situation. Is this code basically doing things the right way for this?

Thanks…


#2

Just a guess, but I’m wondering how the 2nd “When true” to lock the door gets evaluated.

Maybe you can try replacing the lock section with an IF to evaluate if the door is open or closed.

The only trigger you have is when the lock status changes to unlocked and I’m wondering if the piston is timing out.


#3

Slightly different approach, but this should do what you’re trying to do… including starting the WAIT period to lock after the door closes (no matter how long it has been open):

One thing I did was get rid of the “when true/false” sections. Inside an IF condition, something has already evaluated either true or false so it’s an unnecessary step/clutter.