Color inconistency when using hue


#1

1) Give a description of the problem
I am capturing a bulb’s hue value. When I use that same value to set the bulbs color, the color is different.

2) What is the expected behaviour?
The hue I capture will result in the same color when I set the bulb using the captured value.

3) What is happening/not happening?
We have a RGBW bulb over the sink in the kitchen whose color is used to show the status of different things. For example, if the garage door is opened, it turns pink. If the gate into the backyard is open, it’s orange. If water is detected, it’s red.

What I am trying to do is capture the lights current state, save it, and then reset the light back to what it was. That way if the garage door is open and the light is pink, it will change to orange when the gate is opened, but go back to pink when the gate is closed so we know the garage door is still open.

The piston in the attached screen shot works with one exception. When I reset the color using the hue value that was captured and stored in the lightColor variable, the color is different. The value is the same but the color of the bulb is different. For example, if I set the bulb to green, and then open and close the gate, the bulb gets set to light blue when the gate is closed.

Does anyone know why the value I get for the bulb’s hue results in a different color when I reset it using the exact same value?

Misc stuff: The bulb won’t return color (it’s always blank) so I have to use hue. Also, I’m not using capture and restore attributes as those commands are always unreliable for me. All of the push messages are just for debugging.

TIA for any thoughts or suggestions as to how I can fix the discrepancy in colors.

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

5) Attach logs after turning logging level to Full
8/24/2022, 2:20:47 PM +586ms
+4ms ╔Received event [Home].time = 1661372447532 with a delay of 54ms, canQueue: true, calledMyself: false
+18ms ║RunTime initialize > 17 LockT > 1ms > r9T > 2ms > pistonT > 0ms (first state access 14 5 12)
+23ms ║Runtime (12000 bytes) initialized in 2ms (v0.3.114.20220714_HE)
+30ms ║╔Execution stage started
+51ms ║║Calculating (string)Gate was closed. lightOn is + (string)true >> (string)Gate was closed. lightOn is true
+53ms ║║Calculating (string)Gate was closed. lightOn is true + (string). Setting level to >> (string)Gate was closed. lightOn is true. Setting level to
+55ms ║║Calculating (string)Gate was closed. lightOn is true. Setting level to + (string)100 >> (string)Gate was closed. lightOn is true. Setting level to 100
+57ms ║║Calculating (string)Gate was closed. lightOn is true. Setting level to 100 + (string) and color to >> (string)Gate was closed. lightOn is true. Setting level to 100 and color to
+60ms ║║Calculating (string)Gate was closed. lightOn is true. Setting level to 100 and color to + (string)118 >> (string)Gate was closed. lightOn is true. Setting level to 100 and color to 118
+62ms ║║Calculating (string)Gate was closed. lightOn is true. Setting level to 100 and color to 118 + (string). >> (string)Gate was closed. lightOn is true. Setting level to 100 and color to 118.
+88ms ║║Executed virtual command [Sink Light].sendPushNotification (20ms)
+96ms ║║Executed virtual command setVariable (1ms)
+102ms ║║Executed virtual command setVariable (2ms)
+108ms ║║Executed virtual command setVariable (2ms)
+114ms ║╚Execution stage complete. (83ms)
+119ms ╚Event processed successfully (115ms)
8/24/2022, 2:20:46 PM +891ms
+3ms ╔Received event [Side Gate].contact = closed with a delay of 21ms, canQueue: true, calledMyself: false
+17ms ║RunTime initialize > 15 LockT > 1ms > r9T > 2ms > pistonT > 0ms (first state access 12 4 11)
+21ms ║Runtime (11990 bytes) initialized in 2ms (v0.3.114.20220714_HE)
+22ms ║╔Execution stage started
+29ms ║║Comparison (enum) closed changes_to (string) open = false (1ms)
+32ms ║║Condition #2 evaluated false (6ms)
+34ms ║║Condition group #1 evaluated false (condition changed) (8ms)
+40ms ║║Comparison (string) :23d61524837a6b2934ec2783ee3e87f4: is_any_of (string) :5fd38bb05278864e858c60e0d78f1eb4:,:89f46e258ae4d3eb36eca2f6833b9467: = false (1ms)
+42ms ║║Condition #5 evaluated false (6ms)
+43ms ║║Condition group #4 evaluated false (condition did not change) (7ms)
+48ms ║║Comparison (enum) closed changes_to (string) closed = true (1ms)
+50ms ║║Condition #24 evaluated true (6ms)
+53ms ║║Condition group #23 evaluated true (condition changed) (8ms)
+59ms ║║Comparison (enum) closed is (string) open = false (1ms)
+61ms ║║Condition #26 evaluated false (6ms)
+62ms ║║Condition group #25 evaluated false (condition did not change) (7ms)
+67ms ║║Comparison (dynamic) true is (boolean) true = true (2ms)
+70ms ║║Condition #32 evaluated true (6ms)
+72ms ║║Condition group #31 evaluated true (condition changed) (8ms)
+105ms ║║Executed physical command [Sink Light].setLevel(100) (22ms)
+107ms ║║Executed [Sink Light].setLevel W (25ms)
+132ms ║║Executed physical command [Sink Light].setColor([hex: #000000, hue:0, saturation:0, level:0]) (16ms)
+134ms ║║Executed [Sink Light].setColor W (20ms)
+140ms ║║Executed virtual command [Sink Light].wait (1ms)
+146ms ║║Requesting wake up at Wed, Aug 24 2022 @ 2:20:47 PM MDT (in 496ms) for 33 (st:36)
+161ms ║╚Execution stage complete. (138ms)
+204ms ║Setting up scheduled job for Wed, Aug 24 2022 @ 2:20:47 PM MDT (in 501ms)
+207ms ╚Event processed successfully (204ms)
8/24/2022, 2:20:39 PM +598ms
+6ms ╔Received event [Side Gate].contact = open with a delay of 27ms, canQueue: true, calledMyself: false
+131ms ║RunTime initialize > 130 LockT > 1ms > r9T > 116ms > pistonT > 114ms (first state access 13 7 123)
+136ms ║Runtime (11683 bytes) initialized in 116ms (v0.3.114.20220714_HE)
+139ms ║╔Execution stage started
+145ms ║║Comparison (enum) open changes_to (string) open = true (1ms)
+147ms ║║Condition #2 evaluated true (6ms)
+153ms ║║Comparison (string) :23d61524837a6b2934ec2783ee3e87f4: is_any_of (string) :23d61524837a6b2934ec2783ee3e87f4:,:18e2186ca0d5a3446d4e55c749accf18: = true (1ms)
+155ms ║║Condition #3 evaluated true (6ms)
+157ms ║║Condition group #1 evaluated true (condition changed) (15ms)
+163ms ║║Comparison (enum) on is (string) on = true (1ms)
+165ms ║║Condition #9 evaluated true (6ms)
+166ms ║║Condition group #8 evaluated true (condition did not change) (7ms)
+176ms ║║Executed virtual command setVariable (2ms)
+184ms ║║Executed virtual command setVariable (2ms)
+192ms ║║Executed virtual command setVariable (2ms)
+199ms ║║Calculating (string)lightOn is + (string)true >> (string)lightOn is true
+200ms ║║Calculating (string)lightOn is true + (string). Level is >> (string)lightOn is true. Level is
+203ms ║║Calculating (string)lightOn is true. Level is + (string)100 >> (string)lightOn is true. Level is 100
+204ms ║║Calculating (string)lightOn is true. Level is 100 + (string) and color is >> (string)lightOn is true. Level is 100 and color is
+207ms ║║Calculating (string)lightOn is true. Level is 100 and color is + (string)118 >> (string)lightOn is true. Level is 100 and color is 118
+247ms ║║Executed virtual command sendPushNotification (35ms)
+285ms ║║Executed physical command [Sink Light].setColor([hex: #FFA500, hue:11, saturation:100, level:50]) (21ms)
+287ms ║║Executed [Sink Light].setColor W (29ms)
+293ms ║║Skipped execution of physical command [Sink Light].on([]) because it would make no change to the device. (1ms)
+295ms ║║Executed [Sink Light].on (3ms)
+319ms ║║Executed physical command [Sink Light].setLevel(50) (16ms)
+321ms ║║Executed [Sink Light].setLevel W (20ms)
+326ms ║║Comparison (enum) open changes_to (string) closed = false (0ms)
+328ms ║║Condition #24 evaluated false (4ms)
+330ms ║║Condition group #23 evaluated false (condition did not change) (7ms)
+335ms ║╚Execution stage complete. (197ms)
+340ms ╚Event processed successfully (334ms)


#2

Start with giving it a few seconds wait after capture before restoring the values and see if it makes a difference. The HE version got so much faster it’s annoying lol ;D

If the added wait works, then start reducing the wait to a more acceptable level.


#3

I finally figured it out. I looked more closely at the device and noticed that it supported both hue and saturation, so I set both of those instead of just hue it’s now working as expected. Only 80 more devices and 40 more pistons to migrate from ST to HE. :sunglasses: