Piston to loop until an action is confirmed


#1

1) Give a description of the problem
I’m trying to create a nightlight piston. The problem is that maybe about 10% of the time, the nightlight doesnt activate even when the piston has successfully launched. Looking at the logs, it seems that it may be a communication issue. So I’ve placed a turn on, wait 3 seconds, turn on string of commands, and this seems to solve the issue. This seems a little archaic, so I tried to do this with loop commands (send turn on command until light is on, or while loop). the until loop doesnt work at all. The while loop goes through more than 10 cycles before it stops looping. I thought it may be a lag, even a 10 second delay does not seem to help.

2) What is the expected behavior?
ST will send a signal to turn on the light. if that fails to light, then it will loop until it is successful.

3) What is happening/not happening?
The loop continues for many cycles. So if I were to turn off the light manually, it will continue to turn on until the loop ends.

**4) Post a Green Snapshot of the piston![

Will a device poll solve my problem. Does this poll a single device? Refresh did not work.

Thanks in advance!


#2

Here is a simplified version of what I would like to do. Turn on lights when there is motion, turn off lights when there is no motion. However, sometimes, a simple turn on command doesnt always work. So I would like a failsafe, and was hoping a loop would work. Instead, it loops MANY times and takes forever to complete. Here is the log for this this simplified piston.

1/2/2019, 6:29:08 PM +576ms
+2ms ╔Received event [Entryway Sensor].motion = inactive with a delay of 620ms
+130ms ║RunTime Analysis CS > 14ms > PS > 86ms > PE > 30ms > CE
+133ms ║Runtime (38306 bytes) successfully initialized in 86ms (v0.3.108.20180906) (130ms)
+134ms ║╔Execution stage started
+145ms ║║Comparison (enum) inactive changes_to (string) active = false (1ms)
+147ms ║║Cancelling condition #3’s schedules…
+148ms ║║Condition #3 evaluated false (8ms)
+150ms ║║Cancelling condition #1’s schedules…
+151ms ║║Condition group #1 evaluated false (state changed) (11ms)
+157ms ║║Comparison (enum) inactive changes_to (string) inactive = true (0ms)
+159ms ║║Cancelling condition #4’s schedules…
+160ms ║║Condition #4 evaluated true (8ms)
+161ms ║║Cancelling condition #2’s schedules…
+162ms ║║Condition group #2 evaluated true (state changed) (10ms)
+165ms ║║Cancelling statement #5’s schedules…
+178ms ║║Executed physical command [Foyer Lights].off() (9ms)
+179ms ║║Executed [Foyer Lights].off (11ms)
+183ms ║╚Execution stage complete. (49ms)
+184ms ╚Event processed successfully (184ms)
1/2/2019, 6:28:33 PM +224ms
+2ms ╔Received event [Entryway Sensor].motion = active with a delay of 639ms
+134ms ║RunTime Analysis CS > 18ms > PS > 103ms > PE > 12ms > CE
+136ms ║Runtime (38311 bytes) successfully initialized in 103ms (v0.3.108.20180906) (134ms)
+138ms ║╔Execution stage started
+148ms ║║Comparison (enum) active changes_to (string) active = true (1ms)
+150ms ║║Cancelling condition #3’s schedules…
+151ms ║║Condition #3 evaluated true (7ms)
+152ms ║║Cancelling condition #1’s schedules…
+154ms ║║Condition group #1 evaluated true (state changed) (10ms)
+166ms ║║Comparison (enum) off is (string) off = true (2ms)
+168ms ║║Condition #8 evaluated true (11ms)
+169ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+172ms ║║Cancelling statement #9’s schedules…
+194ms ║║Executed physical command [Foyer Lights].setLevel([60]) (17ms)
+195ms ║║Executed [Foyer Lights].setLevel (19ms)
+206ms ║║Comparison (enum) off is (string) off = true (2ms)
+208ms ║║Condition #8 evaluated true (10ms)
+209ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+212ms ║║Cancelling statement #9’s schedules…
+229ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+230ms ║║Executed [Foyer Lights].setLevel (14ms)
+241ms ║║Comparison (enum) off is (string) off = true (2ms)
+243ms ║║Condition #8 evaluated true (11ms)
+244ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+247ms ║║Cancelling statement #9’s schedules…
+265ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+266ms ║║Executed [Foyer Lights].setLevel (15ms)
+277ms ║║Comparison (enum) off is (string) off = true (2ms)
+279ms ║║Condition #8 evaluated true (11ms)
+280ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+284ms ║║Cancelling statement #9’s schedules…
+302ms ║║Executed physical command [Foyer Lights].setLevel([60]) (14ms)
+303ms ║║Executed [Foyer Lights].setLevel (15ms)
+314ms ║║Comparison (enum) off is (string) off = true (2ms)
+316ms ║║Condition #8 evaluated true (9ms)
+317ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+320ms ║║Cancelling statement #9’s schedules…
+338ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+339ms ║║Executed [Foyer Lights].setLevel (14ms)
+350ms ║║Comparison (enum) off is (string) off = true (2ms)
+352ms ║║Condition #8 evaluated true (10ms)
+353ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+357ms ║║Cancelling statement #9’s schedules…
+373ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+374ms ║║Executed [Foyer Lights].setLevel (13ms)
+384ms ║║Comparison (enum) off is (string) off = true (2ms)
+386ms ║║Condition #8 evaluated true (10ms)
+387ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+390ms ║║Cancelling statement #9’s schedules…
+407ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+408ms ║║Executed [Foyer Lights].setLevel (14ms)
+418ms ║║Comparison (enum) off is (string) off = true (2ms)
+420ms ║║Condition #8 evaluated true (10ms)
+422ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+425ms ║║Cancelling statement #9’s schedules…
+442ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+443ms ║║Executed [Foyer Lights].setLevel (14ms)
+454ms ║║Comparison (enum) off is (string) off = true (2ms)
+456ms ║║Condition #8 evaluated true (9ms)
+457ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+460ms ║║Cancelling statement #9’s schedules…
+476ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+478ms ║║Executed [Foyer Lights].setLevel (13ms)
+488ms ║║Comparison (enum) off is (string) off = true (2ms)
+490ms ║║Condition #8 evaluated true (10ms)
+491ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+494ms ║║Cancelling statement #9’s schedules…
+512ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+513ms ║║Executed [Foyer Lights].setLevel (15ms)
+524ms ║║Comparison (enum) off is (string) off = true (2ms)
+526ms ║║Condition #8 evaluated true (11ms)
+527ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+530ms ║║Cancelling statement #9’s schedules…
+547ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+548ms ║║Executed [Foyer Lights].setLevel (13ms)
+558ms ║║Comparison (enum) off is (string) off = true (2ms)
+560ms ║║Condition #8 evaluated true (10ms)
+561ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+564ms ║║Cancelling statement #9’s schedules…
+581ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+582ms ║║Executed [Foyer Lights].setLevel (14ms)
+593ms ║║Comparison (enum) off is (string) off = true (1ms)
+595ms ║║Condition #8 evaluated true (10ms)
+596ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+599ms ║║Cancelling statement #9’s schedules…
+616ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+617ms ║║Executed [Foyer Lights].setLevel (14ms)
+627ms ║║Comparison (enum) off is (string) off = true (2ms)
+629ms ║║Condition #8 evaluated true (10ms)
+630ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+633ms ║║Cancelling statement #9’s schedules…
+650ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+651ms ║║Executed [Foyer Lights].setLevel (14ms)
+662ms ║║Comparison (enum) off is (string) off = true (2ms)
+664ms ║║Condition #8 evaluated true (10ms)
+665ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+668ms ║║Cancelling statement #9’s schedules…
+684ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+685ms ║║Executed [Foyer Lights].setLevel (13ms)
+695ms ║║Comparison (enum) off is (string) off = true (2ms)
+697ms ║║Condition #8 evaluated true (10ms)
+698ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+701ms ║║Cancelling statement #9’s schedules…
+717ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+718ms ║║Executed [Foyer Lights].setLevel (13ms)
+729ms ║║Comparison (enum) off is (string) off = true (2ms)
+731ms ║║Condition #8 evaluated true (11ms)
+732ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+735ms ║║Cancelling statement #9’s schedules…
+752ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+753ms ║║Executed [Foyer Lights].setLevel (13ms)
+763ms ║║Comparison (enum) off is (string) off = true (2ms)
+765ms ║║Condition #8 evaluated true (10ms)
+766ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+769ms ║║Cancelling statement #9’s schedules…
+785ms ║║Executed physical command [Foyer Lights].setLevel([60]) (10ms)
+786ms ║║Executed [Foyer Lights].setLevel (12ms)
+796ms ║║Comparison (enum) off is (string) off = true (1ms)
+798ms ║║Condition #8 evaluated true (9ms)
+799ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+802ms ║║Cancelling statement #9’s schedules…
+818ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+819ms ║║Executed [Foyer Lights].setLevel (13ms)
+829ms ║║Comparison (enum) off is (string) off = true (2ms)
+831ms ║║Condition #8 evaluated true (9ms)
+832ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+835ms ║║Cancelling statement #9’s schedules…
+854ms ║║Executed physical command [Foyer Lights].setLevel([60]) (13ms)
+855ms ║║Executed [Foyer Lights].setLevel (15ms)
+866ms ║║Comparison (enum) off is (string) off = true (2ms)
+867ms ║║Condition #8 evaluated true (10ms)
+869ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+872ms ║║Cancelling statement #9’s schedules…
+888ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+889ms ║║Executed [Foyer Lights].setLevel (13ms)
+899ms ║║Comparison (enum) off is (string) off = true (2ms)
+901ms ║║Condition #8 evaluated true (10ms)
+902ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+905ms ║║Cancelling statement #9’s schedules…
+922ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+923ms ║║Executed [Foyer Lights].setLevel (14ms)
+935ms ║║Comparison (enum) off is (string) off = true (2ms)
+937ms ║║Condition #8 evaluated true (10ms)
+938ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+941ms ║║Cancelling statement #9’s schedules…
+957ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+959ms ║║Executed [Foyer Lights].setLevel (13ms)
+969ms ║║Comparison (enum) off is (string) off = true (2ms)
+971ms ║║Condition #8 evaluated true (10ms)
+972ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+975ms ║║Cancelling statement #9’s schedules…
+991ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+992ms ║║Executed [Foyer Lights].setLevel (13ms)
+1004ms ║║Comparison (enum) off is (string) off = true (2ms)
+1006ms ║║Condition #8 evaluated true (11ms)
+1007ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+1010ms ║║Cancelling statement #9’s schedules…
+1025ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1026ms ║║Executed [Foyer Lights].setLevel (12ms)
+1037ms ║║Comparison (enum) off is (string) off = true (2ms)
+1039ms ║║Condition #8 evaluated true (9ms)
+1040ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1043ms ║║Cancelling statement #9’s schedules…
+1059ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1060ms ║║Executed [Foyer Lights].setLevel (13ms)
+1071ms ║║Comparison (enum) off is (string) off = true (2ms)
+1073ms ║║Condition #8 evaluated true (10ms)
+1074ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1077ms ║║Cancelling statement #9’s schedules…
+1094ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1095ms ║║Executed [Foyer Lights].setLevel (14ms)
+1105ms ║║Comparison (enum) off is (string) off = true (2ms)
+1107ms ║║Condition #8 evaluated true (10ms)
+1108ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1111ms ║║Cancelling statement #9’s schedules…
+1128ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1130ms ║║Executed [Foyer Lights].setLevel (14ms)
+1142ms ║║Comparison (enum) off is (string) off = true (2ms)
+1144ms ║║Condition #8 evaluated true (12ms)
+1145ms ║║Condition group #7 evaluated true (state did not change) (14ms)
+1148ms ║║Cancelling statement #9’s schedules…
+1164ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1165ms ║║Executed [Foyer Lights].setLevel (13ms)
+1176ms ║║Comparison (enum) off is (string) off = true (2ms)
+1178ms ║║Condition #8 evaluated true (10ms)
+1179ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1182ms ║║Cancelling statement #9’s schedules…
+1199ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1200ms ║║Executed [Foyer Lights].setLevel (14ms)
+1212ms ║║Comparison (enum) off is (string) off = true (2ms)
+1214ms ║║Condition #8 evaluated true (12ms)
+1215ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+1218ms ║║Cancelling statement #9’s schedules…
+1235ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1236ms ║║Executed [Foyer Lights].setLevel (14ms)
+1248ms ║║Comparison (enum) off is (string) off = true (2ms)
+1250ms ║║Condition #8 evaluated true (11ms)
+1251ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+1254ms ║║Cancelling statement #9’s schedules…
+1272ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1273ms ║║Executed [Foyer Lights].setLevel (15ms)
+1284ms ║║Comparison (enum) off is (string) off = true (2ms)
+1285ms ║║Condition #8 evaluated true (10ms)
+1287ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1290ms ║║Cancelling statement #9’s schedules…
+1307ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1308ms ║║Executed [Foyer Lights].setLevel (14ms)
+1318ms ║║Comparison (enum) off is (string) off = true (2ms)
+1320ms ║║Condition #8 evaluated true (10ms)
+1321ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1324ms ║║Cancelling statement #9’s schedules…
+1342ms ║║Executed physical command [Foyer Lights].setLevel([60]) (13ms)
+1343ms ║║Executed [Foyer Lights].setLevel (15ms)
+1354ms ║║Comparison (enum) off is (string) off = true (2ms)
+1356ms ║║Condition #8 evaluated true (10ms)
+1357ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1360ms ║║Cancelling statement #9’s schedules…
+1379ms ║║Executed physical command [Foyer Lights].setLevel([60]) (13ms)
+1380ms ║║Executed [Foyer Lights].setLevel (15ms)
+1394ms ║║Comparison (enum) off is (string) off = true (2ms)
+1396ms ║║Condition #8 evaluated true (13ms)
+1397ms ║║Condition group #7 evaluated true (state did not change) (16ms)
+1400ms ║║Cancelling statement #9’s schedules…
+1417ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1418ms ║║Executed [Foyer Lights].setLevel (14ms)
+1429ms ║║Comparison (enum) off is (string) off = true (2ms)
+1431ms ║║Condition #8 evaluated true (10ms)
+1432ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1435ms ║║Cancelling statement #9’s schedules…
+1451ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1452ms ║║Executed [Foyer Lights].setLevel (13ms)
+1464ms ║║Comparison (enum) off is (string) off = true (2ms)
+1466ms ║║Condition #8 evaluated true (11ms)
+1467ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+1470ms ║║Cancelling statement #9’s schedules…
+1487ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1488ms ║║Executed [Foyer Lights].setLevel (13ms)
+1498ms ║║Comparison (enum) off is (string) off = true (2ms)
+1500ms ║║Condition #8 evaluated true (9ms)
+1501ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1504ms ║║Cancelling statement #9’s schedules…
+1520ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1521ms ║║Executed [Foyer Lights].setLevel (13ms)
+1531ms ║║Comparison (enum) off is (string) off = true (2ms)
+1533ms ║║Condition #8 evaluated true (10ms)
+1534ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1537ms ║║Cancelling statement #9’s schedules…
+1556ms ║║Executed physical command [Foyer Lights].setLevel([60]) (13ms)
+1557ms ║║Executed [Foyer Lights].setLevel (16ms)
+1568ms ║║Comparison (enum) off is (string) off = true (2ms)
+1570ms ║║Condition #8 evaluated true (11ms)
+1571ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1574ms ║║Cancelling statement #9’s schedules…
+1590ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1591ms ║║Executed [Foyer Lights].setLevel (13ms)
+1602ms ║║Comparison (enum) off is (string) off = true (2ms)
+1604ms ║║Condition #8 evaluated true (10ms)
+1606ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1609ms ║║Cancelling statement #9’s schedules…
+1625ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1626ms ║║Executed [Foyer Lights].setLevel (13ms)
+1637ms ║║Comparison (enum) off is (string) off = true (2ms)
+1639ms ║║Condition #8 evaluated true (11ms)
+1640ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1643ms ║║Cancelling statement #9’s schedules…
+1660ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1661ms ║║Executed [Foyer Lights].setLevel (14ms)
+1671ms ║║Comparison (enum) off is (string) off = true (2ms)
+1673ms ║║Condition #8 evaluated true (10ms)
+1674ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1677ms ║║Cancelling statement #9’s schedules…
+1696ms ║║Executed physical command [Foyer Lights].setLevel([60]) (14ms)
+1698ms ║║Executed [Foyer Lights].setLevel (16ms)
+1709ms ║║Comparison (enum) off is (string) off = true (2ms)
+1710ms ║║Condition #8 evaluated true (10ms)
+1712ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1715ms ║║Cancelling statement #9’s schedules…
+1731ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+1733ms ║║Executed [Foyer Lights].setLevel (13ms)
+1743ms ║║Comparison (enum) off is (string) off = true (2ms)
+1745ms ║║Condition #8 evaluated true (10ms)
+1746ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1749ms ║║Cancelling statement #9’s schedules…
+1769ms ║║Executed physical command [Foyer Lights].setLevel([60]) (14ms)
+1770ms ║║Executed [Foyer Lights].setLevel (15ms)
+1780ms ║║Comparison (enum) off is (string) off = true (2ms)
+1782ms ║║Condition #8 evaluated true (10ms)
+1783ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1786ms ║║Cancelling statement #9’s schedules…
+1802ms ║║Executed physical command [Foyer Lights].setLevel([60]) (10ms)
+1803ms ║║Executed [Foyer Lights].setLevel (12ms)
+1813ms ║║Comparison (enum) off is (string) off = true (2ms)
+1815ms ║║Condition #8 evaluated true (9ms)
+1816ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1819ms ║║Cancelling statement #9’s schedules…
+1836ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1837ms ║║Executed [Foyer Lights].setLevel (14ms)
+1849ms ║║Comparison (enum) off is (string) off = true (2ms)
+1851ms ║║Condition #8 evaluated true (11ms)
+1853ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+1856ms ║║Cancelling statement #9’s schedules…
+1873ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1874ms ║║Executed [Foyer Lights].setLevel (13ms)
+1885ms ║║Comparison (enum) off is (string) off = true (2ms)
+1887ms ║║Condition #8 evaluated true (10ms)
+1888ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1891ms ║║Cancelling statement #9’s schedules…
+1908ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1910ms ║║Executed [Foyer Lights].setLevel (14ms)
+1921ms ║║Comparison (enum) off is (string) off = true (2ms)
+1923ms ║║Condition #8 evaluated true (10ms)
+1924ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+1927ms ║║Cancelling statement #9’s schedules…
+1945ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1946ms ║║Executed [Foyer Lights].setLevel (15ms)
+1957ms ║║Comparison (enum) off is (string) off = true (2ms)
+1959ms ║║Condition #8 evaluated true (11ms)
+1960ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+1963ms ║║Cancelling statement #9’s schedules…
+1980ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+1981ms ║║Executed [Foyer Lights].setLevel (13ms)
+1991ms ║║Comparison (enum) off is (string) off = true (2ms)
+1993ms ║║Condition #8 evaluated true (10ms)
+1995ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+1998ms ║║Cancelling statement #9’s schedules…
+2014ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2016ms ║║Executed [Foyer Lights].setLevel (13ms)
+2026ms ║║Comparison (enum) off is (string) off = true (2ms)
+2028ms ║║Condition #8 evaluated true (10ms)
+2029ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2032ms ║║Cancelling statement #9’s schedules…
+2048ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2050ms ║║Executed [Foyer Lights].setLevel (13ms)
+2060ms ║║Comparison (enum) off is (string) off = true (2ms)
+2062ms ║║Condition #8 evaluated true (10ms)
+2064ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2067ms ║║Cancelling statement #9’s schedules…
+2086ms ║║Executed physical command [Foyer Lights].setLevel([60]) (14ms)
+2088ms ║║Executed [Foyer Lights].setLevel (16ms)
+2098ms ║║Comparison (enum) off is (string) off = true (2ms)
+2100ms ║║Condition #8 evaluated true (10ms)
+2101ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2104ms ║║Cancelling statement #9’s schedules…
+2122ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2123ms ║║Executed [Foyer Lights].setLevel (14ms)
+2134ms ║║Comparison (enum) off is (string) off = true (2ms)
+2136ms ║║Condition #8 evaluated true (11ms)
+2137ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2140ms ║║Cancelling statement #9’s schedules…
+2157ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2158ms ║║Executed [Foyer Lights].setLevel (14ms)
+2169ms ║║Comparison (enum) off is (string) off = true (2ms)
+2171ms ║║Condition #8 evaluated true (10ms)
+2172ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2175ms ║║Cancelling statement #9’s schedules…
+2193ms ║║Executed physical command [Foyer Lights].setLevel([60]) (13ms)
+2195ms ║║Executed [Foyer Lights].setLevel (15ms)
+2207ms ║║Comparison (enum) off is (string) off = true (2ms)
+2209ms ║║Condition #8 evaluated true (12ms)
+2210ms ║║Condition group #7 evaluated true (state did not change) (14ms)
+2213ms ║║Cancelling statement #9’s schedules…
+2231ms ║║Executed physical command [Foyer Lights].setLevel([60]) (13ms)
+2232ms ║║Executed [Foyer Lights].setLevel (15ms)
+2243ms ║║Comparison (enum) off is (string) off = true (2ms)
+2245ms ║║Condition #8 evaluated true (9ms)
+2246ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2249ms ║║Cancelling statement #9’s schedules…
+2265ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2266ms ║║Executed [Foyer Lights].setLevel (13ms)
+2277ms ║║Comparison (enum) off is (string) off = true (2ms)
+2279ms ║║Condition #8 evaluated true (11ms)
+2280ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2283ms ║║Cancelling statement #9’s schedules…
+2300ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2301ms ║║Executed [Foyer Lights].setLevel (14ms)
+2312ms ║║Comparison (enum) off is (string) off = true (2ms)
+2314ms ║║Condition #8 evaluated true (11ms)
+2315ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2318ms ║║Cancelling statement #9’s schedules…
+2335ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2336ms ║║Executed [Foyer Lights].setLevel (13ms)
+2346ms ║║Comparison (enum) off is (string) off = true (2ms)
+2348ms ║║Condition #8 evaluated true (9ms)
+2349ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2352ms ║║Cancelling statement #9’s schedules…
+2369ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2370ms ║║Executed [Foyer Lights].setLevel (14ms)
+2387ms ║║Comparison (enum) off is (string) off = true (2ms)
+2389ms ║║Condition #8 evaluated true (16ms)
+2391ms ║║Condition group #7 evaluated true (state did not change) (18ms)
+2393ms ║║Cancelling statement #9’s schedules…
+2410ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2411ms ║║Executed [Foyer Lights].setLevel (13ms)
+2422ms ║║Comparison (enum) off is (string) off = true (2ms)
+2424ms ║║Condition #8 evaluated true (10ms)
+2425ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2428ms ║║Cancelling statement #9’s schedules…
+2447ms ║║Executed physical command [Foyer Lights].setLevel([60]) (15ms)
+2448ms ║║Executed [Foyer Lights].setLevel (16ms)
+2460ms ║║Comparison (enum) off is (string) off = true (2ms)
+2461ms ║║Condition #8 evaluated true (10ms)
+2463ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2466ms ║║Cancelling statement #9’s schedules…
+2481ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2483ms ║║Executed [Foyer Lights].setLevel (12ms)
+2494ms ║║Comparison (enum) off is (string) off = true (2ms)
+2496ms ║║Condition #8 evaluated true (11ms)
+2497ms ║║Condition group #7 evaluated true (state did not change) (13ms)
+2500ms ║║Cancelling statement #9’s schedules…
+2517ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2518ms ║║Executed [Foyer Lights].setLevel (14ms)
+2529ms ║║Comparison (enum) off is (string) off = true (2ms)
+2531ms ║║Condition #8 evaluated true (10ms)
+2532ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2535ms ║║Cancelling statement #9’s schedules…
+2552ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2553ms ║║Executed [Foyer Lights].setLevel (14ms)
+2564ms ║║Comparison (enum) off is (string) off = true (2ms)
+2566ms ║║Condition #8 evaluated true (9ms)
+2567ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2570ms ║║Cancelling statement #9’s schedules…
+2587ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2588ms ║║Executed [Foyer Lights].setLevel (14ms)
+2598ms ║║Comparison (enum) off is (string) off = true (2ms)
+2600ms ║║Condition #8 evaluated true (10ms)
+2601ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2604ms ║║Cancelling statement #9’s schedules…
+2620ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2621ms ║║Executed [Foyer Lights].setLevel (13ms)
+2632ms ║║Comparison (enum) off is (string) off = true (1ms)
+2634ms ║║Condition #8 evaluated true (9ms)
+2635ms ║║Condition group #7 evaluated true (state did not change) (12ms)
+2638ms ║║Cancelling statement #9’s schedules…
+2653ms ║║Executed physical command [Foyer Lights].setLevel([60]) (10ms)
+2654ms ║║Executed [Foyer Lights].setLevel (12ms)
+2664ms ║║Comparison (enum) off is (string) off = true (2ms)
+2666ms ║║Condition #8 evaluated true (10ms)
+2668ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2671ms ║║Cancelling statement #9’s schedules…
+2686ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2687ms ║║Executed [Foyer Lights].setLevel (12ms)
+2697ms ║║Comparison (enum) off is (string) off = true (2ms)
+2699ms ║║Condition #8 evaluated true (10ms)
+2701ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2703ms ║║Cancelling statement #9’s schedules…
+2719ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2720ms ║║Executed [Foyer Lights].setLevel (13ms)
+2730ms ║║Comparison (enum) off is (string) off = true (2ms)
+2732ms ║║Condition #8 evaluated true (9ms)
+2734ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2737ms ║║Cancelling statement #9’s schedules…
+2752ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2753ms ║║Executed [Foyer Lights].setLevel (13ms)
+2763ms ║║Comparison (enum) off is (string) off = true (2ms)
+2765ms ║║Condition #8 evaluated true (10ms)
+2766ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2769ms ║║Cancelling statement #9’s schedules…
+2787ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2788ms ║║Executed [Foyer Lights].setLevel (15ms)
+2798ms ║║Comparison (enum) off is (string) off = true (2ms)
+2800ms ║║Condition #8 evaluated true (10ms)
+2801ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2804ms ║║Cancelling statement #9’s schedules…
+2820ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2821ms ║║Executed [Foyer Lights].setLevel (13ms)
+2831ms ║║Comparison (enum) off is (string) off = true (2ms)
+2833ms ║║Condition #8 evaluated true (10ms)
+2835ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2838ms ║║Cancelling statement #9’s schedules…
+2855ms ║║Executed physical command [Foyer Lights].setLevel([60]) (11ms)
+2856ms ║║Executed [Foyer Lights].setLevel (14ms)
+2866ms ║║Comparison (enum) off is (string) off = true (2ms)
+2868ms ║║Condition #8 evaluated true (10ms)
+2870ms ║║Condition group #7 evaluated true (state did not change) (11ms)
+2873ms ║║Cancelling statement #9’s schedules…
+2890ms ║║Executed physical command [Foyer Lights].setLevel([60]) (12ms)
+2891ms ║║Executed [Foyer Lights].setLevel (14ms)
+2904ms ║║Comparison (enum) off is (string) off = true (2ms)
+2906ms ║║Condition #8 evaluated true (12ms)
+2907ms ║║Condition group #7 evaluated true (state did not change) (14ms)


#3

This seems convoluted. You have the same tigger showing up in two different if statements so I’m not sure what will happen if motion sensor 1 or 3 changes to active. In the second if, you have two loops with internal time constraint. I think you need to move the time constraint inside the loop maybe with if/then since the while is based on the switch. It seems it would get stuck in the first loop no matter what time it is and just do nothing as long as the switch stayed off and outside the time constraint.


#4

guxdude, thanks for the reply.

Sorry, newbie here. I’m not sure if I understand your statement.

Just to clarify, this particular light is the foyer lights. I have a sensor at the bottom of the stairs, the top of the stairs and at the end of the hall. I want the foyer lights to switch on when any one of those sensors trigger. Hence the first if statement.

The first “else if” statement is to turn off the lights. but I only want it to turn off if both the bottom stair and upstair sensors are BOTH off. I don’t care if someone is down hall.

The second if statement is for the upstairs and end of hall sensor. I want the hallway lights to be triggered by these 2. The 2 time conditions is because my kids are asleep by 8, and I don’t want to wake them up when I’m walking down the hall.

The second “else if” statement is to turn off the hallway lights. Again, only when both are off.

It actually works fine. However, sometimes it fails to turn on the lights. When I put a string of commands:
Set light to 30%
Wait 3 seconds
set light to 30%
The piston runs almost perfectly. So my thought is that the piston executes the command, but about 10% of the time it seems to not activate the lights. So I was thinking a loop could act as a failsafe.

In my second post, I included a simplified version of the piston with the logs. You can see that it loops forever, even though the light has been switched on.

I hope this helps describe my situation. Am I fundamentally thinking about this wrong?

Thanks again for your help.


#5

It looks like we were posting at the same time so I didn’t see your simplified version. In the simplified version, the piston will get stuck repeating the set level command until either the switch is turned on or the loop is interrupted by the motion inactive trigger. Since these commands execute very fast, the endless repetition is not only unnecessary, it bogs down the server. If you need the extra command for a failsafe, it is best to just do the wait and then execute again. In your original post for the second if (upstairs and end of hall) you have two separate loops. Just like in your simplified example, this second if will always get caught in the first loop until the switch is turned on so it will never execute your lower level lighting. better logic would be:

While
switch is off
do
if time is between 45 minutes to sunset and 8PM
set level 40%
else if tine is between 8PM and 10 PM [maybe go to next sunrise in case you get up in the middle of the night?]
set level 10%
endif
wait 5 seconds
endwhile

Better is to eliminate the loop as I described earlier but hopefully this helps you understand the overall logic.


#6

I agree with @guxdude. The more you spam your network with loops, the more likely some command will not reach it’s device.

Another thing to keep in mind:
If certain lights seem to occasionally miss commands, it is worth considering location. If the device is a bit far from the hub, there should be other devices in the middle to pass along the commands smoother. (mesh network)


#7

Thank you both for your help. Here is what I have so far, seems to work. I thought that the loop would be a more sophisticated failsafe, but I suppose it doesn’t work as I hoped for reasons guxdude points out. I got rid of the loops altogether, and used execute/wait/execute route. The only thing is that it does get a little annoying to have a 3 second delay for nightlights when the first execute fails. I played around with shorter times, and 3 seconds for some reason seems to be the tipping point. shorter waits still result in some failed executions.

WCmore, I do have a smart things outlet in middle of my house. It’s just one room over from my hub, and one room over from that is my foyer. I assumed this would do the trick, but it still fails. Am I missing something here. All I did was plug it in and add it to devices. Do I need to do something else to make it work as a repeater?


#8

Well, more devices often means a better mesh coverage, but it is not mandatory if your placement is good and the devices are reliable. I often find the biggest culprit for the occasional missed commands is an over-worked home network. (if too many commands are trying to be sent simultaneously, some may get lost along the way) I try to program with the intention of never having more than one piston running at any one moment. (it’s not always 100% attainable, but it is always my goal)


#9

Just did some research on the matter. I have more than 20 leviton z wave switches through my house. It is my understanding that these actually act as a mesh. So I’m assuming that I should be covered. I guess the outlet is zigbee, I dont have to many zigbee devices in my home.

I dont have too many pistons. Just one for modes, nightlights and daily routines (happens daily at sunrise, sunset and midnight). So not sure why. Maybe interference?

I play a strat, which has single coil pickups. These pick up RF as noise, and boy it is NOISY in my house. But not so much elsewhere. Maybe I have too much RF in my house.


#10

Once connected, AC powered switches usually act as a mesh automatically… but keep in mind a solid Zwave mesh does not mean your Zigbee mesh is reliable. (they are two separate entities) I may go to extremes a bit, but I tend to draw a crude overhead map view of the house, and use one color to mark each Zwave device that is plugged in, and another color to mark each Zigbee device plugged in. It really helps me to pinpoint weaknesses or choke points.
(battery powered devices usually do not pass data, so I mark them differently)

Just a small observation:
That single piston you posted above, has 9 different triggers. This means your piston runs thru the code (top to bottom) when any of the 9 events happen. In a nutshell, this is the type of piston that I would expect to occasionally have dropped commands.

(Note how line 18 & 54 have identical triggers, as well as lines 41 & 77)


#11

Do you recommend splitting these into different pistons to decrease the number of triggers? Or does that not matter?

Thanks again for your help and input!


#12

Everyone has their own style here really…

Personally, I try to only keep one trigger (or less) in each piston. Usually, the only time I will use two triggers is if they are opposites of the same device and attribute. (such as motion active/inactive)

Following this method, the only time I get sluggish responses is when I am doing some heavy downloading, but that is really my own fault, so I cannot blame my SmartHome.

Just to clarify, I get quite complex within each piston, but with only one trigger (lightning bolt), my responses are incredibly reliable. (for contrast, just imagine if 5 pistons all have the line: “IF Kitchen’s Motion changes to active”, then all 5 pistons will run code from top to bottom each time the cat walks by)


Also, when I have a few pistons that run on a regular schedule…
I run them “daisy chained” so no two are running at the same moment.

Piston One

Every 30 minutes   (Trigger)
    Do a bunch of stuff
    Execute Piston Two

Piston Two

Do a bunch of stuff
Execute Piston Three

Piston Three

Do a bunch of stuff
Execute Piston Four

etc.

Notice in all of these, only the first one has a trigger.


#13

Thanks again for all of your help.

As an update, I have separated ALL of my pistons to be single triggers (other than else if opposites such as if switch changes to on else if switch changes to off). I have to say it definitely has reduced missed commands. I am getting a couple of missed commands here and there, but I’m not sure if it’s because of my buggy code (still trying to iron out these pistons I have separated), but it is much smoother.