[DEPRECATED] Ask Alexa 2.2.3

Do the bulbs work with any other application that you can readily change its value…like Core? There hasn’t been an update for about a month on Ask Alexa, so unless you have been tweaking the code then nothing change on the app side.

I will say the API delivers a 360 degree (color wheel) number for hue, so Ask Alexa divides and rounds the number (h/3.6) to deliver the standard 0-100 hue setting required by the set color command. For example, sea green comes back with hue: 146, sat: 50 and lum : 36. If you plug these number into a color picker (http://hslpicker.com/) It comes up with the correct color. However, 146 is invalid for smarthings so that number is delivered at 146/3 or about 41. You didn’t mention HOW you were trying to get these colors, but if it is a simple “set light to sea green” you can put a debug statement at 1688 and send a debug of the values. Here is what I get for Sea Green:

[hue:41, saturation:50]

Note that I have decided to ignore the lum setting in my app as people usually want to keep the levels they already have. I notice in your log that this is what you are showing as well.

Please try this with other app. Again, I can’t get this to fail on my side, but don’t have Hue bulbs. I don’t understand why your DTH is changing this to another number…did you recently change it?

Yes–trying to change the color by just typing it into the Service Simulator for Ask Alexa. I don’t think it’s the Hue/Saturation as from my logs for Sea Green, H41S50 is exactly what is being called for.

So just to see the effect on “invalid” ST colors here are a couple of logs showing commonality in the xy transform errors:

Peru:
3:29:11 PM: debug NO Update Needed for level.
3:29:11 PM: trace Hue B Smart Bulb: updateStatus ( bri:254 )
3:29:11 PM: debug NO Update Needed for switch.
3:29:11 PM: trace Hue B Smart Bulb: updateStatus ( on:true )
3:29:11 PM: debug NO Update Needed for transitionTime.
3:29:11 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:25 )
3:29:10 PM: debug newHue = 62, newSat = 0
3:29:10 PM: debug colorData from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
3:29:10 PM: debug HS from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
3:29:10 PM: debug colorData = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
3:29:10 PM: trace getHSfromRGB ( 99.99217, 100.00159, 100.02278):
3:29:10 PM: debug RGB colorData = [red:72.27135992018889, green:72.27419726850489, blue:72.28058418098786]
3:29:10 PM: trace Hue B Smart Bulb: updateStatus ( xy:[0.3227, 0.3290] )
3:29:10 PM: debug NO Update Needed for transitionTime.
3:29:10 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:25 )
3:29:08 PM: debug Setting level to 254.
3:29:08 PM: trace Hue B Smart Bulb: setLevel ( 100 ):
3:29:08 PM: debug Sending [transitiontime:25, xy:[0.32272673, 0.3290229]]
3:29:08 PM: debug xy from HSB = 0.32272673 , 0.3290229 .
3:29:08 PM: debug red = 5.2494684E7 / r = 65025.0
3:29:08 PM: trace colorFromHSB ( 8, 59, 100): really h 28.80, s 0.59, v 1
3:29:08 PM: trace sendToHub: no XY values, so get from Hue & Saturation.
3:29:08 PM: trace Hue B Smart Bulb: sendToHub ( [hue:8, saturation:59] ):
3:29:08 PM: debug Hue B Smart Bulb: setColor( [hue:8, saturation:59] ).

Wheat:
3:26:58 PM: debug NO Update Needed for level.
3:26:58 PM: trace Hue B Smart Bulb: updateStatus ( bri:254 )
3:26:58 PM: debug NO Update Needed for switch.
3:26:58 PM: trace Hue B Smart Bulb: updateStatus ( on:true )
3:26:58 PM: debug NO Update Needed for transitionTime.
3:26:58 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:25 )
3:26:58 PM: debug newHue = 62, newSat = 0
3:26:58 PM: debug colorData from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
3:26:58 PM: debug HS from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
3:26:58 PM: debug colorData = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
3:26:58 PM: trace getHSfromRGB ( 99.99217, 100.00159, 100.02278):
3:26:58 PM: debug RGB colorData = [red:72.27135992018889, green:72.27419726850489, blue:72.28058418098786]
3:26:58 PM: trace Hue B Smart Bulb: updateStatus ( xy:[0.3227, 0.3290] )
3:26:58 PM: debug NO Update Needed for transitionTime.
3:26:58 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:25 )
3:26:57 PM: debug Setting level to 254.
3:26:57 PM: trace Hue B Smart Bulb: setLevel ( 100 ):
3:26:57 PM: debug Sending [transitiontime:25, xy:[0.32272673, 0.3290229]]
3:26:57 PM: debug xy from HSB = 0.32272673 , 0.3290229 .
3:26:57 PM: debug red = 5.2494684E7 / r = 65025.0
3:26:57 PM: trace colorFromHSB ( 11, 77, 100): really h 39.60, s 0.77, v 1
3:26:57 PM: trace sendToHub: no XY values, so get from Hue & Saturation.
3:26:57 PM: trace Hue B Smart Bulb: sendToHub ( [hue:11, saturation:77] ):
3:26:57 PM: debug Hue B Smart Bulb: setColor( [hue:11, saturation:77] ).

Looking at all four problematic colors logs, the bottom five log lines up to the “trace debug red…” look correct. Problem starts with the “debug xy from HSB…” line when it looks like all of them from then on have exactly the SAME calculations eventhough they should be different. They all say “debug xy from HSB = 0.32272673 , 0.3290229 .”

Here are the correct “xy from HSB…” ones for red, blue, and green:
red: debug xy from HSB = 0.7006062 , 0.29930097 .
green: debug xy from HSB = 0.17257804 , 0.74665946 .
blue: debug xy from HSB = 0.13552798 , 0.039890125 .

Looks like to me the transform to xy from HSB doesn’t work for many of the colors. Not sure where this is done. @infofiend may have an idea as well?

Actually, the colors have been broken for awhile–weeks actually. I just didn’t have time to track it down to see what was happening since I usually use “scenes” and those colors all seem to work fine. Also, setting colors using numerous hue apps on android works. So does actually using the color “wheel” in the ST app.

I remembered I had some limited problems originally with Smatthings colors and just got round to checking them all again on different bulbs to see whether it was a driver issue.

So investigating further, if I am in the ST control page, and Colormode for the bulb is set to HS (Hue & Saturation), when I try to change the Saturation, the level goes to where I touched on the bar, then immediately goes to zero! Then when I change the hue, the saturation bar immediately jumps to 100. Then the Colormode itself changes to “xy” for a moment, and all the sliders (Hue, Sat, Color Temp) all move, then resets itself back to Colormode: HS.

You keep saying ‘invalid colors from SmartThings’, and they are ‘broken’ but I am not sure that is 100% accurate, or at least shouldn’t be pointed to SmartThings API. The values are being pulled and are correct from SmartThings (which it appears you confirmed), and Ask Alexa only does a transformation from a 360 degree color wheel to 0-100% scale for hue, and then simply setting the saturation. I spent the last hour testing almost every variation in color. The numbers are being delivered to my bulbs correct (albeit I have some issues with the names they use :))

It still isn’t clear where you are getting your log entries from (is it from the bulb DTH), but it appears in your logs each of them the correct color values are being delivered…and that the DTH is recalculating them for some reason. You experience with the color selector is common and a weakness of the SmartThings Mobile App itself.

Do you have Core? While I almost feel that this is not an Ask Alexa issue, I would want to ensure that when you set ‘wheat’ on Core it does/doesn’t work as with the other apps.

Sorry–I’m just referring to the fancy colors that aren’t working in my setup. I’m not sure whether to call them “invalid,” “broken,” or “problematic.” Regardless, the logs are from the bulb.

As I’ve indicated, I’m not sure it’s Ask Alexa either after looking into it. The Hue and Saturation values looks correct. The problem comes in the transform to xy and I’m not sure why it’s doing it either, or why it’s doing it incorrectly for a lot of/or a majority of the standard ST colors.

It could be that @infofiend 's device handlers and/or app are the ones at fault?

In any case, I just installed CoRE, but since I haven’t worked with it, I’m not sure how to use it to set one of the bulb’s colors to test?

AH…you hare using a custom DTH…I would be interested in what is happening there, but from the logs it APPEARS to be converting the HSL back to RGB. If that is the case is the DTH looking for RGB? I can actually put in a switch to provide it…truth be told I was planning for this but found no app that actually required RGB.

To test this in Core you need to create a piston…Just create an ‘if’ event and then the “then” result will be turning on a colored bulb to sea green…

Thanks for the clarification…

Yes–custom DTH. I mentioned it at the bottom of my initial post:

I just tried it with CoRE, and sure enough, same problem with the same log entries! It has to be the @infofiend DTH. I’m not quite sure what it’s expecting, although this “feature” is stated in his thread:

It indicates that he converts those HSB values to xy before sending to the hub. So it does seem like to me that the @infofiend DTH is miscalculating the transform’s leading to the invalid xy coordinates being sent to the hue hub? I sure hope his RGB transforms are correct.

I have deprecated this thread in anticipation of tomorrow’s update. I recommend if you are new user to waiting until 2.2.4 is announced before installing.

I miscalculated? What blasphemy!!!

Despite my general practice not to address such comments from Infidels and non-believers - I think that its very possible that my conversions are part of the problem. Its a thorny area, and I certainly am not an expert in the math for color conversions. If you have thoughts on where the error lies - or any other suggestions, I’m all ears.

In the meantime, I’ll double-check the code to see if I’m passing along all of the proper variables…

EDIT - Just now catching up on everything - I see that the change @M3Rocket made in the HBS pull request solved the color issue for you. Many thanks for tracking that down!

1 Like

@infofiend LOL!

Yes–this infidel was a little bit anal retentive about the colors. Even with my limited jihadi programming skillz, I managed to track it down, fix it, and submitted the pull request. :sunglasses: I’m just glad you documented your code.

1 Like