Piston that fires first time switch is turned on each day


#1

1) Give a description of the problem
I’ve got a piston, and it’s been working, but this morning it didn’t work with one of the switches. Why? I think it may have to do with the “paused at a semiphore” having dorked up the changed trigger…ie, the piston paused because both fired at the same time, and so the one that paused no longer found the “changed” condition to be true. But that’s just my theory. Looking for help from you smart people.

2) What is the expected behaviour?
I’ve got motion sensors in the kids rooms. I disable the motion sensor at night (don’t want lights turning on), then the first time the switch turns on in the morning, the switch should be set back to occupancy mode.

3) What is happening/not happening?
This morning it worked for one of the switches but not both.

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
Here’s a log for the one that didn’t work (kid2) and the one that did (kid1).

5/3/2019, 6:35:21 AM +541ms
+1ms	╔Received event [Kid2 Room Light].switch = on with a delay of 98ms
+10127ms	║RunTime Analysis CS > 16ms > PS > 10065ms > PE > 47ms > CE
+10128ms	║Piston waited at a semaphore for 10025ms
+10131ms	║Runtime (39110 bytes) successfully initialized in 10065ms (v0.3.10a.20190223) (10128ms)
+10132ms	║╔Execution stage started
+10143ms	║║Comparison (string) :86b429a6f140f9de1b3e6a990b08bdc8: is (string) :86b429a6f140f9de1b3e6a990b08bdc8: = true (2ms)
+10145ms	║║Condition #2 evaluated true (7ms)
+10156ms	║║Comparison (enum) on changes_to (string) on = false (1ms)
+10160ms	║║Cancelling condition #3's schedules...
+10161ms	║║Condition #3 evaluated false (15ms)
+10163ms	║║Cancelling condition #1's schedules...
+10164ms	║║Condition group #1 evaluated false (state changed) (26ms)
+10169ms	║╚Execution stage complete. (38ms)
+10171ms	║Setting up scheduled job for Fri, May 3 2019 @ 7:00:00 PM EDT (in 44668.289s)
+10182ms	╚Event processed successfully (10181ms)
5/3/2019, 6:35:21 AM +533ms
+1ms	╔Received event [Kid1 Room Light].switch = on with a delay of 210ms
+93ms	║RunTime Analysis CS > 14ms > PS > 39ms > PE > 40ms > CE
+95ms	║Runtime (39005 bytes) successfully initialized in 39ms (v0.3.10a.20190223) (94ms)
+97ms	║╔Execution stage started
+107ms	║║Comparison (string) :86b429a6f140f9de1b3e6a990b08bdc8: is (string) :86b429a6f140f9de1b3e6a990b08bdc8: = true (2ms)
+108ms	║║Condition #2 evaluated true (6ms)
+118ms	║║Comparison (enum) on changes_to (string) on = true (1ms)
+123ms	║║Cancelling condition #3's schedules...
+124ms	║║Condition #3 evaluated true (15ms)
+138ms	║║Comparison (time) 23721658 is_before (time) 68400000 = true (7ms)
+139ms	║║Time restriction check passed
+141ms	║║Cancelling condition #9's schedules...
+142ms	║║Condition #9 evaluated true (17ms)
+143ms	║║Cancelling condition #1's schedules...
+144ms	║║Condition group #1 evaluated true (state changed) (42ms)
+147ms	║║Cancelling statement #4's schedules...
+857ms	║║Executed physical command [Kid1 Room Light].Occupancy() (706ms)
+858ms	║║Executed [Kid1 Room Light].Occupancy (708ms)
+864ms	║╚Execution stage complete. (768ms)
+866ms	║Setting up scheduled job for Fri, May 3 2019 @ 7:00:00 PM EDT (in 44677.602s)
+878ms	╚Event processed successfully (878ms)

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


#2

It could be a simple signal problem?


#3

One other trick to keep the semaphores at bay would be to only monitor a single device for the trigger. (Notice both lights came on within 0.008 seconds of each other)

Why not just make the trigger on line 26 to only point to your main device?
(you can still send commands to both of them)


#4

I haven’t had any indications that I’ve had signal problems. Is there anything that points you to believe that? How can I rule that out?


#5

I sometimes use the gentle wake up feature for the kids’ lights, so that’s why they came on within 0.008s of each other. But also sometimes (weekends) the kids get up at different times, so I want the piston to fire off either of the triggers.

I’ve changed the trigger from “changes to” to “is.” I’ll keep an eye on it for a week or so. I think it’ll resolve the disconnect from when it waits at a semiphore since they fire at the same time sometimes.


#6

If you don’t want to change any parameters, you might want to split them up into two separate blocks:

IF Kids1 changes to on
    Then Set Occupancy for Kids1
END IF

IF Kids2 changes to on
    Then Set Occupancy for Kids2
END IF

Every day at {time}
    Then Set both to Manual
END EVERY

It’s the same number of triggers as before, but they each have their own set of instructions.


Pro Tip:
If you program your “gentle wake up” piston to stagger the initial turn on a couple of seconds apart, you will prevent a potential bottleneck at that precise moment each day.