Lights off in basement, inconsistent execution


#1

1) Give a description of the problem
My Piston doesn’t always trigger the off portion correctly. I feel there likely is a simpler way to do what I am trying to do. I think I am struggling with the must be X for/was for Y min. I usually just trigger a countdown timer on last detection, but since I am trying to track 2 times, that method seemed more difficult. The setup is that this is the basement and when going down stairs you trip motion 1. If you go left you go out to the garage so only need the lights on a for a few min. If you go right it goes to a playroom where trip sensor 2 and then if go farther 3. If in the playroom I want to keep the lights on longer since they watch TV down there so sit still.

2) What is the expected behavior?
If Motion sensor 1 has been inactive for 2 min and Motion sensor 2/3 inactive for 10 min, turn off light 1, 2, and outlet.

3) What is happening/not happening?
Sometimes the off portion does not trigger, but looking at the logs I can’t quite figure out why. It seems to me that when the Piston sets up a future scheduled event, when it checks the critiera again, because I have a trigger in each it says state did not change and skips execution.

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
12/23/2017, 10:55:59 AM +154ms +1ms ╔Received event [Home].time = 1514044559549 with a delay of -395ms +207ms ║RunTime Analysis CS > 27ms > PS > 65ms > PE > 114ms > CE +209ms ║Runtime (40697 bytes) successfully initialized in 65ms (v0.2.100.20171211) (207ms) +210ms ║╔Execution stage started +220ms ║║Cancelling condition #5's schedules... +221ms ║║Condition #5 evaluated true (2ms) +268ms ║║Comparison (enum) inactive was_not (string) active = false (35ms) +270ms ║║Cancelling condition #6's schedules... +271ms ║║Condition #6 evaluated false (49ms) +272ms ║║Condition group #7 evaluated false (state did not change) (53ms) +311ms ║║Comparison (enum) inactive was_not (string) active = false (30ms) +313ms ║║Condition #9 evaluated false (40ms) +314ms ║║Condition group #8 evaluated false (state did not change) (41ms) +315ms ║║Condition group #2 evaluated false (state did not change) (97ms) +317ms ║╚Execution stage complete. (107ms) +319ms ╚Event processed successfully (318ms) 12/23/2017, 10:55:24 AM +133ms +1ms ╔Received event [Playroom Motion 1].motion = inactive with a delay of 1098ms +233ms ║RunTime Analysis CS > 53ms > PS > 64ms > PE > 116ms > CE +235ms ║Runtime (40705 bytes) successfully initialized in 64ms (v0.2.100.20171211) (233ms) +236ms ║╔Execution stage started +249ms ║║Comparison (enum) off is (string) off = true (1ms) +250ms ║║Condition #1 evaluated true (9ms) +268ms ║║Comparison (enum) on is (string) on = true (2ms) +270ms ║║Condition #11 evaluated true (19ms) +271ms ║║Condition group #null evaluated true (state did not change) (31ms) +280ms ║║Comparison (enum) inactive stays (string) inactive = true (2ms) +282ms ║║Condition #5 evaluated false (8ms) +283ms ║║Condition group #7 evaluated false (state did not change) (9ms) +311ms ║║Comparison (enum) inactive was_not (string) active = false (23ms) +312ms ║║Condition #9 evaluated false (27ms) +313ms ║║Condition group #8 evaluated false (state did not change) (29ms) +314ms ║║Condition group #2 evaluated false (state did not change) (41ms) +317ms ║╚Execution stage complete. (81ms) +318ms ║Setting up scheduled job for Sat, Dec 23 2017 @ 10:55:59 AM EST (in 35.098s) +330ms ╚Event processed successfully (329ms)


#2

What if you try

IF
Motion Sensor 1, then turn on lights for x period of time

Second, independent statement
If motion sensor 1 followed by motion 2 or 3 (followed by is selectable where you choose AND vs OR in your condition statement)
Then turn on lights for y period of time


#3

Is turn on for X time an action or are you suggesting then on the set a wait?

I also realized I don’t ever want to turn on the outlet, just off. It’s connected to an electric heater.


#4

If you look at your piston only the ‘stay inactive’s’ are subscribed.
I’m not sure if it will make much difference or not, but you could try making the ‘was/were nots’ always subscribe.
Click on the statement, scroll down and click on the settings cog. Now change to always subscribe.


#5

So I adjusted it so that when the 2 min sensor goes inactive it checks to see if either of the 2 10 min sensor were active in the last 30 seconds. If they were, sets wait to 10, otherwise 2. Not as elegant as I would like but will see if it does the job.