If then, Else with two different conditions, two different actions


#1

1) Give a description of the problem
Trying to get a Piston setup to set an LED Indicator light to a specific color based on two different connections.

2) What is the expected behaviour?
Door Locks Locked & Door Contact Sensor closed = Illuminate indicator green
Door Contact Sensor Closed & Door Locks unlocked = illuminate indicator red
Door Contact Sensor open = illuminate indicator white

3) What is happening/not happening?
Green and White indicators are working, can’t get red indicator.

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

5) Attach logs after turning logging level to Full
1/2/2023, 8:38:39 PM +503ms
+3ms ╔Received event [Back Door Lock].lock/physical = locked with a delay of 44ms, canQueue: true, calledMyself: false
+12ms ║RunTime initialize > 11 LockT > 0ms > r9T > 2ms > pistonT > 0ms (first state access 5 m:9 4 7)
+15ms ║Runtime (6859 bytes) initialized in 2ms (v0.3.114.20221228_HE)
+16ms ║╔Execution stage started
+24ms ║║Comparison (enum) locked is (string) locked = true (1ms)
+26ms ║║Comparison (enum) locked is (string) locked = true (1ms)
+27ms ║║Condition #3 evaluated true (7ms)
+34ms ║║Comparison (enum) closed is (string) closed = true (0ms)
+37ms ║║Comparison (enum) open is (string) closed = false (1ms)
+38ms ║║Condition #4 evaluated false (10ms)
+39ms ║║Condition group #1 evaluated false (condition did not change) (19ms)
+45ms ║║Comparison (enum) closed is (string) open = false (1ms)
+47ms ║║Comparison (enum) open is (string) open = true (1ms)
+48ms ║║Condition #7 evaluated true (8ms)
+50ms ║║Condition group #2 evaluated true (condition did not change) (9ms)
+86ms ║║Executed device command [Office Scene Controller ].setLED(4,white,100) (19ms)
+89ms ║╚Execution stage complete. (72ms)
+113ms ╚Event processed successfully (111ms)
1/2/2023, 8:35:59 PM +843ms
+3ms ╔Received event [Back Door].contact = closed with a delay of 26ms, canQueue: true, calledMyself: false
+13ms ║RunTime initialize > 12 LockT > 0ms > r9T > 1ms > pistonT > 0ms (first state access 6 m:11 4 8)
+15ms ║Runtime (6845 bytes) initialized in 1ms (v0.3.114.20221228_HE)
+16ms ║╔Execution stage started
+21ms ║║Comparison (enum) unlocked is (string) locked = false (1ms)
+23ms ║║Condition #3 evaluated false (4ms)
+39ms ║║Comparison (enum) closed is (string) closed = true (1ms)
+40ms ║║Comparison (enum) open is (string) closed = false (1ms)
+41ms ║║Condition #4 evaluated false (17ms)
+42ms ║║Condition group #1 evaluated false (condition did not change) (24ms)
+62ms ║║Comparison (enum) closed is (string) open = false (3ms)
+64ms ║║Comparison (enum) open is (string) open = true (1ms)
+65ms ║║Condition #7 evaluated true (22ms)
+66ms ║║Condition group #2 evaluated true (condition did not change) (23ms)
+123ms ║║Executed device command [Office Scene Controller ].setLED(4,white,100) (46ms)
+126ms ║╚Execution stage complete. (110ms)
+129ms ╚Event processed successfully (125ms)
1/2/2023, 8:35:54 PM +319ms
+5ms ╔Received event [Back Door].contact = open with a delay of 44ms, canQueue: true, calledMyself: false
+34ms ║RunTime initialize > 33 LockT > 0ms > r9T > 3ms > pistonT > 1ms (first state access 25 m:30 5 28)
+55ms ║Runtime (6841 bytes) initialized in 3ms (v0.3.114.20221228_HE)
+56ms ║╔Execution stage started
+95ms ║║Comparison (enum) unlocked is (string) locked = false (24ms)
+115ms ║║Condition #3 evaluated false (53ms)
+128ms ║║Comparison (enum) open is (string) closed = false (0ms)
+129ms ║║Condition #4 evaluated false (13ms)
+130ms ║║Condition group #1 evaluated false (condition did not change) (67ms)
+133ms ║║Comparison (enum) open is (string) open = true (1ms)
+134ms ║║Condition #7 evaluated true (4ms)
+135ms ║║Condition group #2 evaluated true (condition did not change) (5ms)
+162ms ║║Executed device command [Office Scene Controller ].setLED(4,white,100) (19ms)
+165ms ║╚Execution stage complete. (110ms)
+169ms ╚Event processed successfully (166ms)
1/2/2023, 8:35:20 PM +957ms
+10ms ╔Received event [Home].test = 1672709720957 with a delay of 1ms, canQueue: true, calledMyself: false
+32ms ║RunTime initialize > 31 LockT > 15ms > r9T > 1ms > pistonT > 0ms (first state access 5 m:15 25 6)
+42ms ║Runtime (6838 bytes) initialized in 1ms (v0.3.114.20221228_HE)
+43ms ║╔Execution stage started
+54ms ║║Comparison (enum) unlocked is (string) locked = false (0ms)
+55ms ║║Condition #3 evaluated false (4ms)
+58ms ║║Comparison (enum) closed is (string) closed = true (1ms)
+59ms ║║Comparison (enum) open is (string) closed = false (1ms)
+61ms ║║Condition #4 evaluated false (5ms)
+62ms ║║Condition group #1 evaluated false (condition did not change) (11ms)
+66ms ║║Comparison (enum) closed is (string) open = false (1ms)
+67ms ║║Comparison (enum) open is (string) open = true (0ms)
+68ms ║║Condition #7 evaluated true (5ms)
+69ms ║║Condition group #2 evaluated true (condition did not change) (6ms)
+96ms ║║Executed device command [Office Scene Controller ].setLED(4,white,100) (19ms)
+100ms ║╚Execution stage complete. (57ms)
+102ms ╚Event processed successfully (93ms)
1/2/2023, 8:35:15 PM +256ms
+6ms ╔Received event [Home].test = 1672709715256 with a delay of 0ms, canQueue: true, calledMyself: false
+57ms ║RunTime initialize > 56 LockT > 0ms > r9T > 44ms > pistonT > 43ms (first state access 6 m:12 6 50)
+61ms ║Runtime (6893 bytes) initialized in 44ms (v0.3.114.20221228_HE)
+63ms ║╔Execution stage started
+86ms ║║Comparison (enum) unlocked is (string) locked = false (1ms)
+87ms ║║Condition #3 evaluated false (19ms)
+90ms ║║Comparison (enum) closed is (string) closed = true (1ms)
+92ms ║║Comparison (enum) open is (string) closed = false (0ms)
+93ms ║║Condition #4 evaluated false (4ms)
+94ms ║║Condition group #1 evaluated false (condition did not change) (26ms)
+98ms ║║Comparison (enum) closed is (string) open = false (0ms)
+100ms ║║Comparison (enum) open is (string) open = true (2ms)
+101ms ║║Condition #7 evaluated true (7ms)
+102ms ║║Condition group #2 evaluated true (condition did not change) (8ms)
+127ms ║║Executed device command [Office Scene Controller ].setLED(4,white,100) (19ms)
+131ms ║╚Execution stage complete. (68ms)
+135ms ╚Event processed successfully (129ms)
1/2/2023, 8:35:10 PM +9ms
+4ms ╔Starting piston… (v0.3.114.20221228_HE)
+23ms ║╔Subscribing to devices…
+83ms ║║Device missing from piston. Loading all from parent (57ms)
+120ms ║║subscriptions: no triggers, promoting conditions
+122ms ║║Subscribing to Back Door.contact…
+136ms ║║Subscribing to Front Door.contact…
+146ms ║║Subscribing to Back Door Lock.lock…
+159ms ║║Subscribing to Front Door Lock.lock…
+167ms ║║Piston utilizes Office Scene Controller []…
+183ms ║╚Finished subscribing (176ms)
+191ms ║Subscribing to Home.pistonID…(:b16cbebf75bff3f8c326779f91f311b5:)
+209ms ║Comparison (enum) unlocked is (string) locked = false (1ms)
+213ms ║Comparison (enum) closed is (string) closed = true (1ms)
+215ms ║Comparison (enum) open is (string) closed = false (1ms)
+220ms ║Comparison (enum) closed is (string) open = false (1ms)
+221ms ║Comparison (enum) open is (string) open = true (1ms)
+242ms ╚Piston started (239ms)


#2

I can’t see an obvious problem with the logic, but the logs are showing that while the Front Door is Locked it is also Open and you don’t seem to be allowing for that possibility.