2 Wait statements for two different devices are synched (but they shouldn't be)


#1

Hello all. I am working on a super piston that control all of my lights including 2 sets of lights which are controlled by 2 separate motion sensor in two different area of the house (Main floor and Basement). The main floor lights trigger on correctly and when the motion stops the countdown for the main floor lights starts. The issue is that if I trigger the basement motion sensor after the main floor was triggered, when the motion stops, the timer for the basement lights starts, but the main floor lights sync with the basement timer as well. This happens in the other order as well. Essentially both set of lights only turn off when both motion sensor have had no motion for 10 minutes.

The Piston as written

I have made the two ifs async so that they would not depend on one another but it didn’t help.
Not sure on what I am missing, but I am definitely doing something wrong.
I had the below piston in Core which worked fine.

Thank you kindly for the help.


#2

There probably is a way around this using certain different cancellation actions regarding the statements but one sure fire way to fix it is to simply create a separate piston for your second If statement and don’t have them both in the same piston.

The problem you are having is both the main floor sensor and the basement sensor are both subscribing to events and therefore they will both cause the piston to fully re-evaluate on every motion event from either room.

I had the same issue and decided to keep separate pistons for each room so it doesn’t over work the piston from multiple sensors in different rooms. :+1:t3:


#3

Please try changing the task execution policy for your if statements to Execute tasks on condition state change only. Since the conditions check the current state of your devices, any time the piston runs it will hit both of those if’s and perform either the if or the else action.


#4

by default, pistons use a single wait timer. change TSP to allow multiple for both the wait statements. if you select the with statement, the TSP setting is in the top right corner as well. here:

image


#5

Hey Bangali. I tested this but it seems to not have made a difference.

Here is the log
11/09/2017, 23:32:22 +308ms
+2ms â•”Received event [Main Space Motion Sensor].motion = inactive with a delay of 889ms
+168ms â•‘RunTime Analysis CS > 19ms > PS > 57ms > PE > 92ms > CE
+182ms â•‘Runtime (38864 bytes) successfully initialized in 57ms (v0.2.0e7.20170906) (179ms)
+184ms â•‘â•”Execution stage started
+204ms â•‘â•‘Comparison (enum) inactive is (string) active = false (3ms)
+206ms ║║Cancelling condition #278’s schedules…
+208ms â•‘â•‘Condition #278 evaluated false (12ms)
+209ms ║║Cancelling condition #196’s schedules…
+210ms â•‘â•‘Condition group #196 evaluated false (state changed) (16ms)
+221ms â•‘â•‘Executed virtual command [Main Living Room Dimmer].wait (1ms)
+223ms â•‘â•‘Requesting a wake up for Mon, Sep 11 2017 @ 11:42:22 PM MDT (in 600.0s)
+246ms â•‘â•‘Comparison (enum) inactive is (string) active = false (3ms)
+248ms â•‘â•‘Condition #147 evaluated false (15ms)
+249ms â•‘â•‘Condition group #128 evaluated false (state did not change) (17ms)
+261ms â•‘â•‘Executed virtual command [BSMT Dimmer].wait (1ms)
+262ms â•‘â•‘Requesting a wake up for Mon, Sep 11 2017 @ 11:42:22 PM MDT (in 600.0s)
+274ms ║╚Execution stage complete. (91ms)
+278ms â•‘Setting up scheduled job for Mon, Sep 11 2017 @ 11:41:41 PM MDT (in 558.526s), with 3 more jobs pending
+296ms ╚Event processed successfully (296ms)


#6

At the end if I can’t figure it out I will do this, but I’d really like to keep all the light automation in one piston :slight_smile:

@ipaterson When I changed the task execution policy of the If statement to execute task on condition change only it didn’t run. Logs as per below (I think…)

11/09/2017, 23:39:53 +58ms
+2ms â•”Received event [Main Space Motion Sensor].motion = active with a delay of 937ms
+238ms â•‘RunTime Analysis CS > 24ms > PS > 72ms > PE > 142ms > CE
+250ms â•‘Runtime (38874 bytes) successfully initialized in 72ms (v0.2.0e7.20170906) (246ms)
+251ms â•‘â•”Execution stage started
+272ms â•‘â•‘Comparison (enum) active is (string) active = true (3ms)
+275ms ║║Cancelling condition #278’s schedules…
+276ms â•‘â•‘Condition #278 evaluated true (13ms)
+290ms â•‘â•‘Comparison (integer) 10 is_less_than_or_equal_to (integer) 800 = true (3ms)
+296ms ║║Cancelling statement #280’s schedules…
+347ms â•‘â•‘Executed physical command [Main Living Room Dimmer].setLevel([100]) (43ms)
+348ms â•‘â•‘Executed [Main Living Room Dimmer].setLevel (44ms)
+351ms â•‘â•‘Condition #279 evaluated true (73ms)
+352ms ║║Cancelling condition #196’s schedules…
+353ms â•‘â•‘Condition group #196 evaluated true (state changed) (91ms)
+358ms ║║Cancelling statement #212’s schedules…
+365ms â•‘â•‘Skipped execution of physical command [Main Living Room Dimmer].on([]) because it would make no change to the device. (4ms)
+366ms â•‘â•‘Executed [Main Living Room Dimmer].on (6ms)
+389ms â•‘â•‘Comparison (enum) active is (string) active = true (3ms)
+391ms â•‘â•‘Condition #147 evaluated true (18ms)
+404ms â•‘â•‘Comparison (integer) 10 is_less_than_or_equal_to (integer) 350 = true (3ms)
+410ms ║║Cancelling statement #285’s schedules…
+464ms â•‘â•‘Executed physical command [BSMT Dimmer].setLevel([100]) (44ms)
+465ms â•‘â•‘Executed [BSMT Dimmer].setLevel (46ms)
+467ms â•‘â•‘Condition #284 evaluated true (75ms)
+469ms â•‘â•‘Condition group #128 evaluated true (state did not change) (96ms)
+474ms ║║Cancelling statement #144’s schedules…
+482ms â•‘â•‘Skipped execution of physical command [BSMT Dimmer].on([]) because it would make no change to the device. (3ms)
+483ms â•‘â•‘Executed [BSMT Dimmer].on (6ms)
+490ms ║╚Execution stage complete. (239ms)
+499ms ╚Event processed successfully (498ms)


#7

MY MAN!

Please disregard my previous message. Allow multiple worked for Task Scheduling Policy. It made sense that it had to work so I kept on testing…
The reason why i though that it didn’t work is that the wait timer indicator in the trace kept resetting for the device with the wait in queue when the other motion sensor activated.

Now I kept track of times and tested it successfully a bunch of times.
This is what my piston looks like now.

Many thanks again! I am open to critiques if you see other issues with my piston :smile:


#8

disregarded. good work. :slight_smile:

yeah, been thru that myself. :smile:

you are welcome.


#9

nice work btw! i like how you use when true / when false under the illumination condition to set the light level before turning it on when the if condition is true. :slight_smile:


#10

Thanks Man! Webcore is sooo powerful it is ridiculous :slight_smile: So many ways to do things.

The wife told me that the lights were turning off randomly on her with the timer not waiting the full 10 minutes. I “think” that I fixed this in the AM by putting condition changes specific to the action. I will update the screenshot in case it helps others.

Alessandro


#11

yup, in its flexibility lies the power of webcore. :slight_smile:

nice. you should update the screenshot, so any user looking at this thread later sees the latest.


#12

Hello All,

This is the last iteration of the piston. I was away on business and the wife told me that sometime the lights would turn off and not turn back on or not turn off. Le sigh. I have removed the task execution policy for the turning on action and that hopefully fixes it. I will continue to monitor and let you know.

Otherwise I will have to break the piston in different components.