Using wait doesnt seem to work


#1

1) Give a description of the problem
made a very simple piston to turn a light on when motion is detected, then turn it off 30 seconds later
2) What is the expected behavior?
light goes on
3) What is happening/not happening?
light is not turning off
4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
12/6/2018, 4:04:45 PM +65ms
+1ms ╔Received event [Elmwood].time = 1544141086329 with a delay of -1264ms
+133ms ║Runtime (38195 bytes) successfully initialized in 83ms (v0.3.108.20180906) (131ms)
+134ms ║╔Execution stage started
+135ms ║╚Execution stage complete. (1ms)
+137ms ╚Event processed successfully (136ms)
12/6/2018, 4:04:34 PM +232ms
+1ms ╔Received event [M - Kitchen].motion = inactive with a delay of 233ms
+100ms ║Runtime (38187 bytes) successfully initialized in 61ms (v0.3.108.20180906) (97ms)
+101ms ║╔Execution stage started
+115ms ║╚Execution stage complete. (13ms)
+116ms ╚Event processed successfully (116ms)
12/6/2018, 4:04:16 PM +187ms
+2ms ╔Received event [M - Kitchen].motion = active with a delay of 153ms
+107ms ║Runtime (38192 bytes) successfully initialized in 69ms (v0.3.108.20180906) (104ms)
+108ms ║╔Execution stage started
+135ms ║║Executed [Computer Desk].on (5ms)
+140ms ║║Executed virtual command [Computer Desk].wait (0ms)
+141ms ║║Requesting a wake up for Thu, Dec 6 2018 @ 4:04:46 PM PST (in 30.0s)
+147ms ║╚Execution stage complete. (39ms)
+148ms ║Setting up scheduled job for Thu, Dec 6 2018 @ 4:04:46 PM PST (in 29.994s)
+160ms ╚Event processed successfully (160ms)
12/6/2018, 4:04:07 PM +750ms
+1ms ╔Received event [M - Kitchen].motion = inactive with a delay of 136ms
+90ms ║Runtime (38187 bytes) successfully initialized in 53ms (v0.3.108.20180906) (89ms)
+91ms ║╔Execution stage started
+111ms ║╚Execution stage complete. (19ms)
+112ms ╚Event processed successfully (112ms)
12/6/2018, 4:03:52 PM +963ms
+1ms ╔Received event [M - Kitchen].motion = active with a delay of 228ms
+117ms ║Runtime (38192 bytes) successfully initialized in 77ms (v0.3.108.20180906) (115ms)
+118ms ║╔Execution stage started
+140ms ║║Executed [Computer Desk].on (5ms)
+146ms ║║Executed virtual command [Computer Desk].wait (1ms)
+147ms ║║Requesting a wake up for Thu, Dec 6 2018 @ 4:04:23 PM PST (in 30.0s)
+153ms ║╚Execution stage complete. (35ms)
+155ms ║Setting up scheduled job for Thu, Dec 6 2018 @ 4:04:23 PM PST (in 29.994s)
+164ms ╚Event processed successfully (164ms)
12/6/2018, 4:02:45 PM +54ms
+0ms ╔Received event [Elmwood].time = 1544140966042 with a delay of -989ms
+121ms ║Runtime (38194 bytes) successfully initialized in 75ms (v0.3.108.20180906) (119ms)
+122ms ║╔Execution stage started
+123ms ║╚Execution stage complete. (1ms)
+125ms ╚Event processed successfully (126ms)
12/6/2018, 4:02:33 PM +480ms
+2ms ╔Received event [M - Kitchen].motion = inactive with a delay of 144ms
+118ms ║Runtime (38187 bytes) successfully initialized in 77ms (v0.3.108.20180906) (116ms)
+119ms ║╔Execution stage started
+133ms ║╚Execution stage complete. (14ms)
+135ms ╚Event processed successfully (134ms)
12/6/2018, 4:02:15 PM +900ms
+1ms ╔Received event [M - Kitchen].motion = active with a delay of 159ms
+103ms ║Runtime (38192 bytes) successfully initialized in 58ms (v0.3.108.20180906) (101ms)
+104ms ║╔Execution stage started
+134ms ║║Executed [Computer Desk].on (14ms)
+139ms ║║Executed virtual command [Computer Desk].wait (1ms)
+141ms ║║Requesting a wake up for Thu, Dec 6 2018 @ 4:02:46 PM PST (in 30.0s)
+147ms ║╚Execution stage complete. (43ms)
+149ms ║Setting up scheduled job for Thu, Dec 6 2018 @ 4:02:46 PM PST (in 29.994s)
+162ms ╚Event processed successfully (162ms)
12/6/2018, 4:01:49 PM +843ms
+2ms ╔Starting piston… (v0.3.108.20180906)
+243ms ║╔Subscribing to devices…
+251ms ║║Subscribing to M - Kitchen.motion…
+311ms ║║Subscribing to Computer Desk…
+312ms ║╚Finished subscribing (81ms)
+356ms ╚Piston successfully started (356ms)


Question for a Simple Routine. Motion > Action > Wait > Action
#2

Very simple @MR-JR
And we all have experienced the same thing LOL (Us non-coders i am talking about)

Just add NEVER CANCEL TASK to WITH part.

The piston triggers when motion changes to ACTIVE but as soon as that is done (1-2 seconds) the piston is NO LONGER true. So stops everything.
Click on WITH
Find the wheel icon click
you will see TASK CANCELATTION POLICY
choose NEVER CANCEL TASK
SAVE

You will see letter N next to with.

that means, you are telling your piston, “Hey look, even if the triggers are no longer avail, you keep counting 30 seconds…”


#3

But here is what’s gonna happen in real life…
You enter a room…
Lights turn ON
You are still in the room walking around etc
BUT THE LIGHT WILL TURN OFF
and you will be pissed LOL
keep moving and light will be ON again…
Every 30 seconds you will have to move your hands around.
Your wife will give you 24 hours to fix this crap or you are going back to regular lights:)) (this part was my case LOL)
and you will figure out a better way of writing this piston…

IF motion changes to ACTIVE
With
lights
do turn ON

IF motion STAYS INACTIVE for X amount of time.
with
lights
do turn OFF

as long as there is motion in the room lights will never turn OFF…

Of course this example only works if you want your lights to remain ON as long as there is motion. If you are just using your piston for side entrance to your house and all you need is 30 secons lights, than you are good to go.


#4

Thanks Ike2018 … Yes this is what I want and I have been experimenting with INACTIVE… but then read another thread that said to use WAIT … which didnt really make sense … guess I should not believe everything I read on the threads :slight_smile: … I will go back to try INACTIVE and report.

Thanks for your quick response!

James


#5

You are so welcome @MR-JR ,
You can believe what you read, the only thing is there is no one way of writing a piston.
Everyone has a different system, different setup and need.
Even my example can be changed, altered by one of the minions or one of the top posters etc:))) (Webcore masters)
I have main entrance lights and I only use WAIT because trees, leaves, wind can activate the motion sensor and they remain ON all night :))) so in that case using WAIT is much better.

the best is always test, research, test, research :)))))

let me know how it goes:)


#6

Yep … agree … I have been doing X-10 with SHED since 1997 :slight_smile: and know exactly what you mean. I’ve been happily using ST but webCoRE looked way too cool to pass up. The basic issue of lights going off and having to wave your arms every x minutes to turn them back on has always been a mess, so very happy it is easily solved with webCoRE…

I went back to the basic INACTIVE test and it works exactly as expected… must have been doing sth else wrong earlier.

I’ll have to research the other thing about “never cancel … WITH” … didnt need it with the INACTIVE… I have much to learn :slight_smile:

Thank again! and nice to meet you!


#7

Hmm… That might explain why some pistons I was playing with before weren’t working. Could you give some examples of when you would want this on, and when you would want this off?


#8

Sure thing @Mebejedi
First you need to understand that ussualy, a piston is like dripping water from your roof top (lack of a better example)
when it’s triggered a drop starts going from LINE 1 to LINE 100 in just a couple of seconds. (lets say you have 100 lines) And once reaches to 100 the job is done, untill it’s triggered again.
This works great but some situations you need that drop to do other things for various reasons.
Let say in my example piston (don’t mind the variables for now)

This piston is aout theatre room to get ready… Lights slowly turn OFF, projection screen comes down, sound system is ON, Blinds are down etc.

1 - When variable changes to 2 - LINE 71 - (it’s the trigger - just like door changes to open or light changes to OFF etc)
2 - line 78 starts fading movie room lights slowly.
3 - Line 91 Turns the AC on… but it has to set to cool and I don’t use wait 30 seconds, all of the command will run in a sec and AC will miss them all.
4 - Some other lights must wait 30 seconds before turning OFF (Getting ready for the movie and sitting down etc)

If I don’t use NEVER CANCEL what would happen is, the house would catch some of the commands but most would be cancelled because piston is done in 2 seconds.
a) lights would not be turned off (they won’t count down from 45 seconds, it would be down to maybe 41-40-39 but CANCEL)
b) the AC would turn ON but that’s it, it would not register anything after WAIT.

Also there are other situations that NEVER CANCEL is needed without using the WAIT…
If you have an example situation or piston I can tell you more about those as well…


#9

Somewhat off topic, but one thing I’m having trouble is having my Then statements run conterminously. What if you want your Chandelier lights to turn off at the same time your Movie Ceiling lights are fading? Doesn’t the piston execute all of these in order, including waiting on each to finish?

Also, what is that MovieRoomPhases and causes it to change it’s value?


#10

When you are setting your THEN actions, if you hit the gear on the bottom right, you get additional settings. Change the EXECUTION METHOD from SYNCHRONOUS to ASYNCHRONOUS, and the actions will occur simultaneously.

[EDIT] Now that I’m at home, I can provide an example. Notice each of the DOs starts with ASYNC. The lights will flash and announcements go to both echos simultaneously.

Asynch


#11

Hi, @Straggler
Sorry didn’t see your question earlier:
The WAITs i use here just for my needs. Once the movie room setup starts, we are still getting ready and didn’t want lights to turn off sudden. Yes if you don’t add wait, they all will - almost - at the same time turn OFF. Though there are some talks about how many devices ST can handle at the same time, without missing any. In my experience lets say you sent a signal to 30 devices in the same piston - without WAIT - for some reason ST misses some of them. WAIT is just a little failsafe.

Also, what is that MovieRoomPhases and causes it to change it’s value?

I have a complicated setup. (I will write this in detail maybe someone else finds this useful for their setup)
a) We don’t have any routines. No wake up time set, no coming home, going away is in a routine (We work just a couple of hours a day and from home.)
b) And we have three cats:))) so motion detectors are not the main communication method with the house.
c) We don’t like to talk to alexa much LOL

So, each room has at leats 4-5 different “Scenes/Phases” and each Scene has 3-4 alternatives and each room does someting when the other room changes a scene and total of 11 rooms.
If movie room started (PHASE 2) all other rooms lights get dimmed to 10%
if movie room started from my chair that means my wife is a sleep (PHASE 5)
if movie room started from my chair BUT the office phase is 3 (which means ps4 time:)) I am in there playing games) that means my wife is sitting on my chair LOL so lights in the other rooms should not be dimmed (PHASE 6)
So we are talking about tons of combinations, variations.

@WCmore was helping me with my pistons. I was keep adding “this and that and the other” so pistons started getting really complicated and confusing for me to play with. He started using PHASES. (you can call what ever you want, scenes, levels, scenarios etc) its a integer global variable that you can use any number. Once he did upstairs with PHASES i really liked it and applied to each room my self.

Anything you want can change that,
In our movie room setup :
a) Alexa.
b) Wall ipad (Action Tiles) simulated switch
c) Zwave button by the movie chairs
d) Vibration sensor that is attached to feet rest of the motor controlled movie chair.

and a single piston that controls it.
IF a simulated switch is turned on
OR
IF zwave button is pushed
OR
IF sensor is activated
Set global variable to = 2

And when this changes to 2 the piston you see gets triggered (Each room has two pistons only with a bunch of PHASE levels in it)