I have a piston that checks for a garage door that is left open. I don’t want it to trigger an alert unless it is after sundown and only if the garage door is left open for more than 20 minutes. It appears to be working correctly, but I have noticed in the logs that the exit log statement does not execute when certain conditions are met. I find this odd and makes me understand that the pistons don’t work like I expect them to, so I want to try and understand why.
Here is the piston:
Unfortunately, I edited the piston while making this post and lost the logs. I have another garage door with logs, but it does not have the entry that shows the issue since that garage door is rarely used. To give you an idea, this is from the rarely used garage door:
11/1/2019, 8:01:59 AM +49ms
+117ms ║Entering Script
+184ms ║It is not after sunset.
+192ms ║Exiting Script
11/1/2019, 8:00:59 AM +88ms
+226ms ║Entering Script
+341ms ║It is after sunset. Checking garage door…
+359ms ║Exiting Script
10/31/2019, 6:28:59 PM +74ms
+121ms ║Entering Script
+205ms ║It is after sunset. Checking garage door…
+222ms ║Exiting Script
What I saw was an entry that had
It is after sunset. Checking garage door…
Garage door is open, waiting…
And then nothing. I would expect to see the “Exiting Script” log, but I don’t on all of those entries where it hits the Wait block. Can someone explain why the piston exits? I would expect it to simply fall out of the inner IF, then the While loop, then the outer IF and then hit the exit log statement.