Trying to Retrieve Hex Value of RGB Bulb Color


#1

1) Give a description of the problem
Unable to retrieve the current color of an RGB device properly.

2) What is the expected behavior?
I want the background color and color on a piston state to reflect the current color of an RGB bulb.

3) What is happening/not happening?
I am trying to retrieve the color but getting more information than I need. I want just the hex value. I have tried [Device : hex] but that does not work. When asking for color I get “[red:0, green:255, blue:255, white:0, hue:50.0, saturation:100.0, level:100, hex: #00ffff, name:cyan]

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS THEN HIGHLIGHT ALL OF THE LOGS SND CLICK ON THE </> ICON TO FORMAT THEM)

2/8/2018, 7:50:15 AM +657ms
+1ms	╔Starting piston... (v0.2.102.20180116)
+961ms	║╔Subscribing to devices...
+971ms	║║Subscribing to Study Bookshelf LEDs.switch...
+984ms	║║Subscribing to Study Bookshelf LEDs.color...
+1163ms	║╚Finished subscribing (214ms)
+1276ms	║Setting up scheduled job for Thu, Feb 8 2018 @ 5:37:00 PM CST (in 35203.067s), with 2 more jobs pending
+1356ms	╚Piston successfully started (1354ms)
2/8/2018, 7:48:01 AM +23ms
+2ms	╔Received event [Study Bookshelf LEDs].color = [red:0, green:255, blue:255, white:0, hue:50.0, saturation:100.0, level:100, hex:    #00ffff, name:cyan] with a delay of 171ms
+204ms	║RunTime Analysis CS > 44ms > PS > 71ms > PE > 89ms > CE
+207ms	║Runtime (46097 bytes) successfully initialized in 71ms (v0.2.102.20180116) (204ms)
+208ms	║╔Execution stage started
+222ms	║║Cancelling statement #42's schedules...
+227ms	║║Executed virtual command setVariable (2ms)
+243ms	║║Calculating (enum) on == (enum) on >> (boolean) true
+248ms	║║Calculating (string) b, + (string) gold >> (string) b, gold
+250ms	║║Calculating (string)  >> (string) 
+263ms	║║Calculating (string) 100 + (string) % >> (string) 100%
+266ms	║║Calculating (string) 100% + (string) 7:48 AM >> (string) 100% 7:48 AM
+269ms	║║Calculating (string) 100% 7:48 AM + (string) >> (string) 100% 7:48 AM
+276ms	║║Executed virtual command setTile (2ms)
+294ms	║║Calculating (string) 💡 is currently  and set to 💡 is currently  and set tob, [red:0, green:255, blue:255, white:0, hue:50.0, saturation:100.0, level:100, hex:    #00ffff, name:cyan]
+298ms	║║Calculating (string) 💡 is currently  and set to  as of >> (string) 💡 is currently  and set to  as of
+302ms	║║Calculating (string) 💡 is currently  and set to  as of + (string) Feb 08 @ 7:48 AM >> (string) 💡 is currently  and set to  as of Feb 08 @ 7:48 AM
+306ms	║║Calculating (string) 💡 is currently  and set to  as of Feb 08 @ 7:48 AM + (string) >> (string) 💡 is currently  and set to  as of Feb 08 @ 7:48 AM
+310ms	║║Calculating (string) 💡 is currently  as of + (string) Feb 08 @ 7:48 AM >> (string) 💡 is currently  as of Feb 08 @ 7:48 AM
+313ms	║║Calculating (string) 💡 is currently  as of Feb 08 @ 7:48 AM + (string) >> (string) 💡 is currently  as of Feb 08 @ 7:48 AM
+320ms	║║Calculating (enum) on == (enum) on >> (boolean) true
+323ms	║║Executed virtual command setState (1ms)
+327ms	║╚Execution stage complete. (119ms)
+330ms	║Setting up scheduled job for Thu, Feb 8 2018 @ 5:37:00 PM CST (in 35338.648s), with 2 more jobs pending
+341ms	╚Event processed successfully (341ms)

#2

Odd. Mine don’t work that way… I just get the color. But you can brute force your way to getting it using some String functions. mid(blah, indexOf(blah, “#”),7)


#3

Yeah, I was hoping for a more direct solution.

Thanks


#4

What kind of bulbs do you have?

Like I said, when I ask for color on mine (Phillips Hue)… I just get the Hex value.


#5

It’s an RGBWW LED strip on a Fibaro controller using a custom DTH.

Per another thread you helped me in I am setting the color to a value based on temp in part of the piston so at first read one might think I should just use that variable. However, the piston also detects any time the LED are turned on or color is changed so the piston tile and state parts need to pick up on whatever the current setting is. Thus my need to retrieve the hex value.


#6

What’s it show in the ST IDE? This is one of my Hue bulbs.


#7

I went with your suggestion above to extract the hex value in the piston and all is good.


#8

Yeah. That’s about all you can do. The DTH must be populating that field the way it is shown in the IDE. So that’s all WC can do is present you with what the value is there.

The other option would be to modify your DTH…