Executing Action after 10 minutes


#1

1) Give a description of the problem
I would like to wait 10 minutes before executing the final action but I do not know how to add the Wait command.

2) What is the expected behaviour?
I want the ability to tell SmartThings to wait a specified amount of time before continuing through the piston.

3) What is happening/not happening?
I am unsure if it will work as I have designed it. I have used $currentStateDuration stays unchanged. I am not sure what this actually means, but my preference would be to simply Wait 10 minutes. Is there a way to manually type the script instead of using the Piston UI?

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full
(PASTE YOUR LOGS HERE THEN HIGHLIGHT ALL OF THE LOGS AND CLICK ON THE </> ICON TO FORMAT THEM CORRECTLY)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

Where is says to add a task, simply select and scroll down to the bottom and you will find the ‘wait’ command. You can enter the time in seconds, minutes, hours, etc. You can put the wait directly above you ‘Lock’ command. You will have to add it first below and then you can use the drag and drop feature to move it above.

Note: You may not have drag and drop enabled, If not, when in edit mode, click on the button with the two triangles (one above the other).


#3

you might have a problem with line 26 and line 28.

Both are triggers and you are telling your piston to execute ONLY IF they both happen simultaneously.

For the WAIT,

You choose the LOCK first and add wait as @guxdude recommended.
you can also check this post :


#4

Thanks to both of you.

first, line 26 had a typo and should have been Lock 1’s lock changes to unlocked. but with that change and if I delete line 28, it still won’t do what I want because the presence indicator changes to Present BEFORE the lock is unlocked. I’ve since changed the IF/OR conditions to “presence is present” instead of “changes to present.”


#5

Getting three events to occur simultaneously is always a problem. I would suggest:

if contact sensor 1 changes to closed           <--trigger (this is the final event you are interested in)
    and
   lock 1 is unlocked                                      <--condition (earlier event that should be true)
    and
   Any of Presence sensor 1, 2, 3 is present.  <--condition (earlier event that should be true)
then
  with lock
     wait 10 minutes
     lock
  end with
end if

#6

WebCoRE pistons are event handlers and it helps to consider why the piston is running.

Pistons subscribe to device attribute change events (and schedule runs for particular times) that will affect how the piston evaluates. If a piston has triggers, only the events that affect them are considered. If it doesn’t, it looks at all the conditions instead. Your original piston has five triggers. The piston will be executed every time there are changes to any of the presence sensors, the lock, or the contact.

Triggers (generally) work on the information in the event. So for ‘Presence Sensor 1 presence changes to present’ to be true, the piston must firstly be running because an event was received suggesting ‘Presence Sensor 1 presence’ has changed. If it is then the piston will then consider if it has actually changed to ‘present’. If the piston is running because e.g. the contact changed, then ‘Presence Sensor 1 presence’ has NOT changed. So only one of your five trigger conditions will evaluate as true when your piston runs.

As @guxdude has illustrated, you need to think about when your piston needs to execute. In your case the contact changing seems to be the key event so you want that to be when your piston runs, with the current status of presence and lock (“is”) being useful extra checks.

If the events sometimes happen in a different order then you need to program your piston accordingly.