Implement mode with virtual switch


#1

I have four 4 Virtual switch and modes.

  1. A Mode On (Status : A Mode On)
  2. B Mode On (Status : A Mode Off, B Mode On)
  3. A Mode Off (Status : A Mode On, B Mode On) Why??

[Log]

      1. 오전 12:39:40 +936ms
        +1ms ╔Received event [홈 모드].switch = off with a delay of 282ms
        +9867ms ║RunTime Analysis CS > 19ms > PS > 9790ms > PE > 58ms > CE
        +9867ms ║Piston waited at a semaphore for 9774ms
        +9870ms ║Runtime (43052 bytes) successfully initialized in 9790ms (v0.3.104.20180323) (9869ms)
        +9871ms ║╔Execution stage started
        +9880ms ║║Comparison (enum) off is (string) off = true (0ms)
        +9881ms ║║Condition #53 evaluated true (7ms)
        +9881ms ║║Condition group #null evaluated true (state did not change) (8ms)
        +9888ms ║║Condition #15 evaluated false (5ms)
        +9889ms ║║Condition group #1 evaluated false (state did not change) (6ms)
        +9891ms ║║Comparison (enum) off changes_to (string) on = false (0ms)
        +9892ms ║║Condition #27 evaluated false (3ms)
        +9893ms ║║Condition group #2 evaluated false (state did not change) (4ms)
        +9899ms ║║Condition #28 evaluated false (6ms)
        +9900ms ║║Condition group #3 evaluated false (state did not change) (7ms)
        +9906ms ║║Condition #52 evaluated false (5ms)
        +9907ms ║║Condition group #29 evaluated false (state did not change) (6ms)
        +9908ms ║╚Execution stage complete. (37ms)
        +9909ms ╚Event processed successfully (9909ms)
      1. 오전 12:39:42 +71ms
        +1ms ╔Received event [홈 모드].switch = on with a delay of 102ms
        +83ms ║RunTime Analysis CS > 11ms > PS > 15ms > PE > 57ms > CE
        +86ms ║Runtime (42969 bytes) successfully initialized in 15ms (v0.3.104.20180323) (85ms)
        +86ms ║╔Execution stage started
        +95ms ║║Comparison (enum) off is (string) off = true (1ms)
        +96ms ║║Condition #53 evaluated true (7ms)
        +97ms ║║Condition group #null evaluated true (state did not change) (7ms)
        +103ms ║║Cancelling condition #15’s schedules…
        +104ms ║║Condition #15 evaluated false (6ms)
        +104ms ║║Cancelling condition #1’s schedules…
        +105ms ║║Condition group #1 evaluated false (state changed) (7ms)
        +107ms ║║Comparison (enum) on changes_to (string) on = false (0ms)
        +108ms ║║Cancelling condition #27’s schedules…
        +109ms ║║Condition #27 evaluated false (3ms)
        +110ms ║║Cancelling condition #2’s schedules…
        +110ms ║║Condition group #2 evaluated false (state changed) (4ms)
        +115ms ║║Condition #28 evaluated false (4ms)
        +116ms ║║Condition group #3 evaluated false (state did not change) (5ms)
        +122ms ║║Condition #52 evaluated false (5ms)
        +122ms ║║Condition group #29 evaluated false (state did not change) (6ms)
        +124ms ║╚Execution stage complete. (38ms)
        +125ms ╚Event processed successfully (125ms)
      1. 오전 12:39:40 +707ms
        +0ms ╔Received event [외출 모드].switch = on with a delay of 254ms
        +85ms ║RunTime Analysis CS > 13ms > PS > 18ms > PE > 54ms > CE
        +87ms ║Runtime (42976 bytes) successfully initialized in 18ms (v0.3.104.20180323) (86ms)
        +88ms ║╔Execution stage started
        +97ms ║║Comparison (enum) off is (string) off = true (1ms)
        +99ms ║║Condition #53 evaluated true (9ms)
        +100ms ║║Condition group #null evaluated true (state did not change) (10ms)
        +105ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
        +107ms ║║Cancelling condition #15’s schedules…
        +108ms ║║Condition #15 evaluated true (5ms)
        +109ms ║║Cancelling condition #1’s schedules…
        +110ms ║║Condition group #1 evaluated true (state changed) (8ms)
        +112ms ║║Cancelling statement #74’s schedules…
        +128ms ║║Executed physical command [홈 모드].off() (14ms)
        +129ms ║║Executed [홈 모드].off (15ms)
        +194ms ║║Skipped execution of physical command [홈-아침 모드].off([]) because it would make no change to the device. (63ms)
        +195ms ║║Executed [홈-아침 모드].off (65ms)
        +201ms ║║Skipped execution of physical command [홈-취침 모드].off([]) because it would make no change to the device. (4ms)
        +202ms ║║Executed [홈-취침 모드].off (5ms)
        +204ms ║║Cancelling statement #56’s schedules…
        +251ms ║║Executed virtual command setLocationMode (46ms)
        +253ms ║╚Execution stage complete. (165ms)
        +254ms ╚Event processed successfully (255ms)
      1. 오전 12:39:37 +947ms
        +0ms ╔Received event [홈 모드].switch = on with a delay of 231ms
        +88ms ║RunTime Analysis CS > 12ms > PS > 18ms > PE > 59ms > CE
        +91ms ║Runtime (42978 bytes) successfully initialized in 18ms (v0.3.104.20180323) (90ms)
        +92ms ║╔Execution stage started
        +100ms ║║Comparison (enum) off is (string) off = true (1ms)
        +101ms ║║Condition #53 evaluated true (7ms)
        +102ms ║║Condition group #null evaluated true (state did not change) (8ms)
        +109ms ║║Condition #15 evaluated false (5ms)
        +110ms ║║Condition group #1 evaluated false (state did not change) (7ms)
        +112ms ║║Comparison (enum) on changes_to (string) on = true (0ms)
        +113ms ║║Cancelling condition #27’s schedules…
        +114ms ║║Condition #27 evaluated true (4ms)
        +115ms ║║Cancelling condition #2’s schedules…
        +116ms ║║Condition group #2 evaluated true (state changed) (5ms)
        +117ms ║║Cancelling statement #77’s schedules…
        +122ms ║║Skipped execution of physical command [외출 모드].off([]) because it would make no change to the device. (3ms)
        +123ms ║║Executed [외출 모드].off (5ms)
        +126ms ║║Skipped execution of physical command [홈-아침 모드].off([]) because it would make no change to the device. (2ms)
        +127ms ║║Executed [홈-아침 모드].off (3ms)
        +131ms ║║Skipped execution of physical command [홈-취침 모드].off([]) because it would make no change to the device. (3ms)
        +132ms ║║Executed [홈-취침 모드].off (3ms)
        +133ms ║║Cancelling statement #60’s schedules…
        +189ms ║║Executed virtual command setLocationMode (53ms)
        +191ms ║╚Execution stage complete. (100ms)
        +192ms ╚Event processed successfully (193ms)

#2

Instead of using the ELSE IF statements, use separate IF blocks for each switch change.


#3

Did you see the log, right?
What’s the difference?

The result is the same. This is a bug.


#4

Probably not working because of your attempted use of ‘physical interaction’… I highly doubt your devices are reporting that info, most don’t and the ones that can don’t if they are talking through a repeater.

And as @jkp pointed out, use seperate IF blocks instead of elseif… elseif is a legacy thing and really shouldn’t be used.