Piston not executing as expected


#1

1) Give a description of the problem
Piston is delaying more than I want it to - I want it to turn off light/fan if two motion sensors have no movement for 20 minutes (if either register movement, it will reset), but instead, it waits the 20 minutes, and then schedules another task for 20 minutes later to evaluate the state again, and then sets an additional task for 20 minutes beyond that to turn off the devices. Also, it will not fire the TurnOffJacksFan maker event when I have it configured to only do that in between the certain times.

2) What is the expected behavior?
Turn off light if no movement on both sensors for 20 minutes and LUX >30 (indicating the light is on), turn off the fan if no movement on both sensors regardless of LUX.

3) What is happening/not happening?
See above, but it is basically taking 3x longer to run than I want it to. Also, it never executes the TurnOffJacksFan Async If statement (will do it if I take out the time constraints though)

**4) Post a Green Snapshot of the piston

5) Attach any logs (From ST IDE and by turning logging level to Full)
NOTE: I changed the time from 20 mins to 2 mins so I didn’t have to wait an hour, but the results are the same…

11/30/2018, 6:52:27 PM +151ms
+0ms â•”Received event [Home].time = 1543629148254 with a delay of -1104ms
+86ms â•‘RunTime Analysis CS > 15ms > PS > 44ms > PE > 27ms > CE
+88ms â•‘Runtime (39322 bytes) successfully initialized in 44ms (v0.3.108.20180906) (87ms)
+91ms â•‘â•”Execution stage started
+103ms â•‘â•‘Cancelling condition #11's schedules...
+105ms â•‘â•‘Condition #11 evaluated true (2ms)
+107ms â•‘â•‘Cancelling condition #1's schedules...
+109ms â•‘â•‘Condition group #1 evaluated true (state changed) (9ms)
+125ms â•‘â•‘Comparison (integer) 33 is_greater_than (integer) 30 = true (3ms)
+128ms â•‘â•‘Condition #4 evaluated true (15ms)
+130ms â•‘â•‘Condition group #3 evaluated true (state did not change) (18ms)
+135ms â•‘â•‘Cancelling statement #5's schedules...
+254ms â•‘â•‘Executed virtual command iftttMaker (113ms)
+261ms â•‘â•šExecution stage complete. (170ms)
+263ms â•šEvent processed successfully (263ms)
11/30/2018, 6:50:28 PM +123ms
+1ms â•”Received event [Home].time = 1543629029034 with a delay of -911ms
+86ms â•‘RunTime Analysis CS > 15ms > PS > 44ms > PE > 26ms > CE
+90ms â•‘Runtime (39321 bytes) successfully initialized in 44ms (v0.3.108.20180906) (88ms)
+92ms â•‘â•”Execution stage started
+105ms â•‘â•‘Cancelling condition #2's schedules...
+107ms â•‘â•‘Condition #2 evaluated true (3ms)
+123ms â•‘â•‘Comparison (enum) inactive stays (string) inactive = true (4ms)
+130ms â•‘â•‘Adding a timed trigger schedule for condition 11
+135ms â•‘â•‘Cancelling condition #11's schedules...
+136ms â•‘â•‘Condition #11 evaluated false (28ms)
+138ms â•‘â•‘Condition group #1 evaluated false (state did not change) (35ms)
+143ms â•‘â•šExecution stage complete. (52ms)
+146ms â•‘Setting up scheduled job for Fri, Nov 30 2018 @ 6:52:28 PM MST (in 119.986s)
+158ms â•šEvent processed successfully (157ms)
11/30/2018, 6:48:28 PM +816ms
+1ms â•”Received event [Aeotec MultiSensor 6].motion = inactive with a delay of 149ms
+199ms â•‘RunTime Analysis CS > 19ms > PS > 159ms > PE > 20ms > CE
+201ms â•‘Runtime (39334 bytes) successfully initialized in 159ms (v0.3.108.20180906) (199ms)
+202ms â•‘â•”Execution stage started
+215ms â•‘â•‘Comparison (enum) inactive stays (string) inactive = true (2ms)
+218ms â•‘â•‘Adding a timed trigger schedule for condition 2
+220ms â•‘â•‘Condition #2 evaluated false (12ms)
+222ms â•‘â•‘Condition group #1 evaluated false (state did not change) (13ms)
+224ms â•‘â•šExecution stage complete. (22ms)
+226ms â•‘Setting up scheduled job for Fri, Nov 30 2018 @ 6:50:29 PM MST (in 119.993s)
+244ms â•šEvent processed successfully (244ms)
11/30/2018, 6:48:19 PM +876ms
+2ms â•”Received event [Gameroom Motion Sensor].motion = inactive with a delay of 691ms
+98ms â•‘RunTime Analysis CS > 20ms > PS > 55ms > PE > 22ms > CE
+100ms â•‘Runtime (39333 bytes) successfully initialized in 55ms (v0.3.108.20180906) (97ms)
+102ms â•‘â•”Execution stage started
+122ms â•‘â•‘Comparison (enum) active stays (string) inactive = false (3ms)
+127ms â•‘â•‘Cancelling any timed trigger schedules for condition 2
+128ms â•‘â•‘Cancelling statement #2's schedules...
+130ms â•‘â•‘Condition #2 evaluated false (21ms)
+132ms â•‘â•‘Condition group #1 evaluated false (state did not change) (24ms)
+136ms â•‘â•šExecution stage complete. (34ms)
+138ms â•šEvent processed successfully (137ms)

#2

I think combining lines 18 & 20 into one line & changing async IFs to regular IF’s should do the trick:

IF 
    All of Motion 5 & Motion 4 stays inactive for 20 mins
Then

    IF 
        illuminance is greater than X
    Then
        Turn off Light
        Wait 5 seconds
    END IF

    IF 
        Time is between Y & Z
    Then
        Turn off Fan
    END IF

END IF

The 5 second Wait command may not be needed, but I have noticed in the past that IFTTT likes a little gap between commands. Feel free to experiment with that. (I would try to keep it 9 seconds or less)


#3

@WCmore: You = Da Man! :slight_smile:

Thank you very much - that did the trick perfectly!!


#4

Glad to be able to help!