What about this
time happens daily at sunset
garage door sensor contact was open for at least 10 min
What about this
I have similar problem, and try to rewrite my piston. How do you write “was open for at least 10 minutes”?
Glad it is working but I’m feel like you are being redundant with your IFs. It doesn’t hurt anything to leave it as is but just my preference to keep piston as light and streamlined as possible.
The only difference being:
first IF will flip your switch at sunset if contact had been open for 10 minutes (switch will only flip once if applicable)
the 2nd IF will wait for the contact to be open for 10 min then check to see if after sunset to flip the switch (continuously checking each time open for 10 min)
I would drop one of the other depending on your ultimate goal of a one time turn on or continuous monitoring after sunset.
was or wasn’t is a condition, once selected it will open up additional drop-downs for comparison to (open or closed) and (at least or less than) a time period
If he drops either one there will be a case missed. You have to deal with
A. door is open for 10 minutes and it is after dark
B. door has been open any amount of time>10 minutes when sunset occurs
If he drops the first if, B will not be covered. If he drops the second if, A will not be covered. There’s no redundancy.
Thanks guys it seems to be working
Just have a question about adding new conditions
When picking the right comparison there are two categories one is conditions and the other triggers
Whats the difference and how do I know what one to use
for instance using a motion senser’s motion as one of the conditions
A trigger would be something like ‘Sensor motion changes to active’. You are explicitly stating that you are interested in changes to the motion attribute of the Sensor. The piston will (by default) subscribe to change events for that attribute and fire whenever it receives one. When it comes to evaluating whether the trigger is true or false the piston will look at the event that fired the piston to see if it involved the attribute and also compare it to a cached previous value. So it is true if the piston is running because the motion changed to active, and false otherwise.
A condition is something like ‘Sensor motion is active’. Clearly that attribute is of interest to you but you aren’t explicitly showing interest in the change. The piston will (by default) only subscribe to change events in conditions if there aren’t any triggers to be found anywhere (it is like a fallback to try and ensure the piston gets run when something has happened that might interest the piston). When the piston runs the condition is evaluated by getting the current value of the device as known to SmartThings, and if the comparison was more complex and involved historical values it would get the previous events from SmartThings too. So it is true if the motion is active at the point of evaluation, regardless of why the piston was fired.
You will see it claimed that only one trigger can be true at once. That is almost right. If the piston fires due to receiving, for example, a Sensor motion change event, then only triggers making comparisons using the Sensor motion attribute can be true. There might be more than one such trigger, though. So what it really means is if, for example, you open a door and walk into a room, ‘contact changes to open’ and ‘motion changes to active’ will not both be true at the same time. There will be two runs of the piston in succession, one where ‘changes to open’ is true and one where ‘motion changes to active’ is true.