Can't Turn On And Immediately Dim Lights


#1

1) Give a description of the problem
I am trying to control 3 dimmable, tunable white lights with 1 virtual switch. Things I’m trying to do with these lights:

  1. When the virtual switch turns on, do the following with all 3 lights:
    a) Set light temp according to a global variable
    b) Turn on
    c) Set brightness level to 100%
  2. If the virtual switch level changes, change the brightness level of all 3 lights.

This all generally works. However, when I try to issue an ‘on’ command immediately followed by a set level command, it only turns on the lights to 100% (the set level command doesn’t work). The set-level command 'waits at a semaphore for 10s, and doesn’t seem to be issued. If I issue a wait for 2s between the on and the set level commands, it works.

2) What is the expected behaviour?
Expected behavior is I can issue an on immediately followed by a set level command.

3) What is happening/not happening?
Issuing an on followed by a set level command only turns on the lights at 100% brightness. The set level command doesn’t succeed - it says waiting at a semaphore for 10s. I’m guessing this has to do with the fact that the trigger for switch on and level changed is in the same piston?

4) Post a Green Snapshot of the pistonimage

5) Attach logs after turning logging level to Full

6/16/2019, 1:04:16 PM +984ms
+2ms	+Received event [Switch (Virtual): Bedroom].level = 25 with a delay of 71ms
+10137ms	¦RunTime Analysis CS > 22ms > PS > 10065ms > PE > 50ms > CE
+10138ms	¦Piston waited at a semaphore for 10020ms
+10141ms	¦Runtime (39145 bytes) successfully initialized in 10065ms (v0.3.10c.20190522) (10138ms)
+10142ms	¦+Execution stage started
+10159ms	¦¦Cancelling condition #10's schedules...
+10160ms	¦¦Condition #10 evaluated false (12ms)
+10161ms	¦¦Cancelling condition #1's schedules...
+10163ms	¦¦Condition group #1 evaluated false (state changed) (14ms)
+10175ms	¦¦Cancelling condition #6's schedules...
+10176ms	¦¦Condition #6 evaluated false (10ms)
+10178ms	¦¦Cancelling condition #2's schedules...
+10179ms	¦¦Condition group #2 evaluated false (state changed) (14ms)
+10189ms	¦¦Comparison (integer) 25 changes = false (0ms)
+10190ms	¦¦Condition #38 evaluated false (7ms)
+10192ms	¦¦Condition group #37 evaluated false (state did not change) (8ms)
+10194ms	¦+Execution stage complete. (53ms)
+10196ms	+Event processed successfully (10196ms)

6/16/2019, 1:04:16 PM +941ms
+1ms	+Received event [Switch (Virtual): Bedroom].switch = on with a delay of 62ms
+111ms	¦RunTime Analysis CS > 21ms > PS > 40ms > PE > 51ms > CE
+114ms	¦Runtime (39070 bytes) successfully initialized in 40ms (v0.3.10c.20190522) (112ms)
+115ms	¦+Execution stage started
+128ms	¦¦Comparison (enum) on changes_to (string) on = true (1ms)
+130ms	¦¦Cancelling condition #10's schedules...
+132ms	¦¦Condition #10 evaluated true (9ms)
+133ms	¦¦Cancelling condition #1's schedules...
+134ms	¦¦Condition group #1 evaluated true (state changed) (13ms)
+137ms	¦¦Cancelling statement #33's schedules...
+157ms	¦¦Executed physical command [Light: Bedroom (Bathroom)].setColorTemperature([6500]) (9ms)
+158ms	¦¦Executed [Light: Bedroom (Bathroom)].setColorTemperature (12ms)
+169ms	¦¦Executed physical command [Light: Bedroom (Deck)].setColorTemperature([6500]) (7ms)
+170ms	¦¦Executed [Light: Bedroom (Deck)].setColorTemperature (10ms)
+180ms	¦¦Executed physical command [Light: Bedroom (Porch)].setColorTemperature([6500]) (7ms)
+181ms	¦¦Executed [Light: Bedroom (Porch)].setColorTemperature (9ms)
+194ms	¦¦Executed physical command [Light: Bedroom (Bathroom)].on() (10ms)
+195ms	¦¦Executed [Light: Bedroom (Bathroom)].on (12ms)
+206ms	¦¦Executed physical command [Light: Bedroom (Deck)].on() (9ms)
+207ms	¦¦Executed [Light: Bedroom (Deck)].on (11ms)
+218ms	¦¦Executed physical command [Light: Bedroom (Porch)].on() (9ms)
+219ms	¦¦Executed [Light: Bedroom (Porch)].on (11ms)
+232ms	¦¦Executed physical command [Light: Bedroom (Bathroom)].setLevel([100]) (8ms)
+233ms	¦¦Executed [Light: Bedroom (Bathroom)].setLevel (10ms)
+244ms	¦¦Executed physical command [Light: Bedroom (Deck)].setLevel([100]) (8ms)
+245ms	¦¦Executed [Light: Bedroom (Deck)].setLevel (11ms)
+256ms	¦¦Executed physical command [Light: Bedroom (Porch)].setLevel([100]) (9ms)
+257ms	¦¦Executed [Light: Bedroom (Porch)].setLevel (11ms)
+270ms	¦¦Condition #38 evaluated false (7ms)
+271ms	¦¦Condition group #37 evaluated false (state did not change) (10ms)
+274ms	¦+Execution stage complete. (159ms)
+276ms	+Event processed successfully (275ms)

#2

Hi there,
Are they PH HUE bulbs?


#3

No, they are sengled tunable white bulbs


#4

You can simplify this by only sending the set level command. This works (with most bulbs) because a “Set level” turns on the light in the process.


#5

just setting level doesn’t appear to fix the problem. lights come on at 100% brightness


#6

What I mean is, “Set level to 50%” will both turn on the light, and set them to 50%.

The one extra tidbit to keep in mind is:
99% of bulbs will turn on at the same color and level they were left at when they last turned off. This means a command of “Set level to 50%” may initially be too bright or dim, but a moment later, the level will adjust appropriately.


#7

Yeah, in the other piston that was first turning on this simulated dimmer switch, then setting the level to 25%, I changed to just set the level to 25%. The simulated dimmer switch only received an ‘on’ event; no set level event. I tried to look at the currentEvent* variables and didn’t see anything that would indicate a level value was being sent with the ‘on’ command. Logs:

6/22/2019, 11:07:23 AM +225ms
+1ms ╔Received event [Switch (Virtual): Bedroom].switch = on with a delay of 64ms
+104ms ║RunTime Analysis CS > 22ms > PS > 36ms > PE > 45ms > CE
+107ms ║Runtime (41763 bytes) successfully initialized in 36ms (v0.3.10c.20190522) (104ms)
+108ms ║╔Execution stage started
+122ms ║║Comparison (enum) on changes_to (string) on = true (1ms)
+124ms ║║Cancelling condition #10's schedules...
+125ms ║║Condition #10 evaluated true (10ms)
+127ms ║║Cancelling condition #1's schedules...
+128ms ║║Condition group #1 evaluated true (state changed) (14ms)
+131ms ║║Cancelling statement #33's schedules...
+149ms ║║Executed physical command [Light: Bedroom (Bathroom)].setColorTemperature([6500]) (8ms)
+151ms ║║Executed [Light: Bedroom (Bathroom)].setColorTemperature (10ms)
+161ms ║║Executed physical command [Light: Bedroom (Deck)].setColorTemperature([6500]) (7ms)
+162ms ║║Executed [Light: Bedroom (Deck)].setColorTemperature (9ms)
+172ms ║║Executed physical command [Light: Bedroom (Porch)].setColorTemperature([6500]) (6ms)
+173ms ║║Executed [Light: Bedroom (Porch)].setColorTemperature (9ms)
+185ms ║║Executed physical command [Light: Bedroom (Bathroom)].on() (9ms)
+187ms ║║Executed [Light: Bedroom (Bathroom)].on (11ms)
+198ms ║║Executed physical command [Light: Bedroom (Deck)].on() (8ms)
+199ms ║║Executed [Light: Bedroom (Deck)].on (11ms)
+210ms ║║Executed physical command [Light: Bedroom (Porch)].on() (8ms)
+211ms ║║Executed [Light: Bedroom (Porch)].on (11ms)
+226ms ║║Executed physical command [Light: Bedroom (Bathroom)].setLevel([100]) (10ms)
+228ms ║║Executed [Light: Bedroom (Bathroom)].setLevel (12ms)
+241ms ║║Executed physical command [Light: Bedroom (Deck)].setLevel([100]) (10ms)
+242ms ║║Executed [Light: Bedroom (Deck)].setLevel (12ms)
+254ms ║║Executed physical command [Light: Bedroom (Porch)].setLevel([100]) (10ms)
+255ms ║║Executed [Light: Bedroom (Porch)].setLevel (12ms)
+259ms ║║Cancelling statement #44's schedules...
+277ms ║║Calculating (string) attr( + (string) switch >> (string) attr(switch
+284ms ║║Calculating (string) attr(switch + (string) ), recv( >> (string) attr(switch), recv(
+291ms ║║Calculating (string) attr(switch), recv( + (string) Sat, Jun 22 2019 @ 11:07:23 AM CDT >> (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT
+297ms ║║Calculating (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT + (string) ), unit( >> (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(
+302ms ║║Calculating (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit( + (string) >> (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(
+306ms ║║Calculating (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit( + (string) ), val( >> (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(), val(
+310ms ║║Calculating (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(), val( + (string) on >> (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(), val(on
+314ms ║║Calculating (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(), val(on + (string) ) >> (string) attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(), val(on)
+319ms ║║attr(switch), recv(Sat, Jun 22 2019 @ 11:07:23 AM CDT), unit(), val(on)
+321ms ║║Executed virtual command log (2ms)
+334ms ║║Condition #38 evaluated false (8ms)
+335ms ║║Condition group #37 evaluated false (state did not change) (10ms)
+338ms ║╚Execution stage complete. (231ms)
+339ms ╚Event processed successfully (339ms)

I may not be understanding your suggestion. Can you provide some pseudo code for what the piston would look like? Would I trigger on something other than the ‘on/off’ value of the simulated switch?

I’m also still curious about the original problem which is that the ‘set level’ command ‘waits at a semaphore for 10 seconds’ - why is that occurring?


#8

This likely means the SimDimmer was at 25% when it was last turned off. If the level doesn’t change, then:
IF SimDimmer's level changes
will not execute.