Door left open piston troubleshooting


#1

1) Give a description of the problem
Piston works but is also giving false positives. Example: if front door is left open for 5 minutes, I get a text saying “Front door has been left open for 5 minutes.” This is good, however, I’m also getting unexpected false positives about three to four times a week where the text messages says “Empty device list has been left open for 5 minutes.” This occurs when no doors have been left open.


#2

Add an expression to check if count(openDoor) > 0, then proceed with SMS. This does not answer why you’re getting some false positives though :slight_smile:


#3

I suspect it is because multiple triggers are attached to the STAY.


#4

I’m not good at this so pardon the question. What would adding that expression do that the piston doesn’t already?


#5

What do you mean by “STAY”? Are you saying have a separate piston for each door?


#6

All it does is check if there is actually a device in the openDoors variable. If it there is, then it does what you want (send the sms). If empty, it just ignores the event and you won’t get the “Empty device list has been left open for 5 minutes.”


#7

Personally, I generally aim for a single trigger per piston…
… but I insist on it when there are STAY triggers at play…

If memory serves me right, any “opens” starts a timer, and any “closes” aborts it.

By placing multiple triggers in this piston, you are limiting your logic, and maximizing the chance that other (unrelated) devices will tamper with your results…


Edit for clarification:

When I say "single trigger", I am including code like this:

ϟ IF DeviceA's contact changes to X
      Then do stuff
  END IF

ϟ IF DeviceA's contact stays Y for 2 min
      Then do other stuff
  END IF

Using this example, you would see two lightning bolts in the margin, but they are both next to “DeviceA’s contact”, so they are treated as a single trigger. (both IFs are evaluated once at each event)

In other words:

All of my triggers for “DeviceA’s contact” will be in a single piston…
… but I can use “DeviceA’s contact” as a condition in dozens of pistons.