Relock Door by Time Acting Strangely


#1

1) Give a description of the problem
This piston is not relocking the door reliably and continually acts as if it’s doing the process twice for each iteration.

2) What is the expected behavior?
The piston should wait for the door status to be Unlocked, note the time and make sure the Front Door is closed. Once those are done if it’s between one time frame it waits 2 minutes and then locks the door. If it’s outside that time frame it waits 30 minutes and then relocks the door.

3) What is happening/not happening?
Prior to adding the logic to check the Front Door status (open/closed) this was working just fine. After adding the more complex code to make sure the door is closed before locking it, it stopped working reliably.

Thanks for any help. It’s also the first use of Repeat that I’ve tried and wonder if that’s part of the issue.


#2

I would be very tempted to streamline this into a few simple commands:

IF Door's contact stays closed for 30 minutes
and
Time is between 7am and 11pm
then Lock door
End IF

IF Door's contact stays closed for 2 minutes
and
Time is *NOT* between 7am and 11pm
then Lock door
End IF

Every day at 11:03pm
Lock Door
End every

(The last block is just a safety net in case your door is closed between 10:31 - 11pm)

This method guarantees the door will only lock itself if the door is already closed.
(opening the door will restart the timer)
It also removes all Wait commands as well as the Repeat.


#3

That’s the sort of response I was really hoping for. Much appreciated. Streamlined seems to be far more reliable with Webcore.


#4

I think it will work well for you… but a full disclaimer, there is ONE event that is not accounted for in the logic…

IF someone walks by the door & unlocks it, but leaves the door closed, it will currently NOT re-lock itself. Personally, I like having this, because if my friend says that she is on the way, I can unlock it (without opening the door) and it will still be unlocked when she arrives ten minutes later.

But, if you suspect a problem with this happening in your household, I have a tiny modification that should cover that scenario.


#5

I’d be curious to see that modification, just in case.

Here’s what I have so far (newbie at this):


#6

Not bad at all. I wasn’t near a computer earlier to send the entire piston, but here it is with the same code, but much less indenting and easier to read (in my opinion)

Feel free to import this one and delete/disable the previous one.


As far as my alternative approach:

You could try switching the two lines that say,
“IF Door’s contact stays closed for X minutes”
to
“IF Lock stays unlocked for X minutes”

but if you go this route, there is a possibility that the door could lock while the door is still open.
(you’d have to add more code to account for this)


#7

I’ll grab your version. Mine actually didn’t work. After an hour the door is still unlocked after opening it and closing it.


#8

Just a tiny note here:

During testing, I often reduce my times to a minute or less.
This lets you do many different tests in a short time period.
Once I am happy with it, I’ll change the times back to the proper numbers…