[DEPRECATED] Ask Alexa 2.2.3

In that case, the ‘communication’ between SmartThings and Amazon is not happening, and that IS typically the Oauth. To be clear, I use “Oauth” a bit more generically than I should…In the help page it will actually say Access Token and Application ID.

In the output of Settings>>Setup Variables should be STappID and STtoken. Even though everything looks fine, might be a good idea to reset the token (on the Settings page) and then follow this items: http://thingsthataresmart.wiki/index.php?title=Ask_Alexa#Setup_Variables

I just re-copied and pasted all three lines in the Lambda code and it works! Thanks again for your assistance!

No problem…glad it is working!

I updated the code today to 2.2.3a…small fix that is not required for operation, but a misspelling that was bugging me :slight_smile:

For those that come by on Friday’s to see if there is a new update to Ask Alexa, per the release notes for 2.2.3, there won’t be one for a few weeks. However, I have reached a milestone in the development, so we are well on our way for another version release soon. For those of you that use the message queue you will find you have a LOT more options to choose from as we prep for Amazon releasing their push notification feature (no ETA yet).

I will be reaching out to my partner community developers before the release so they may prep for using the new features of the message queues. This will include directing messages to specific speakers and customizing the notification methods. Once this structure is in place, it will only be a little work before we can have speaker to speaker communications!

Thanks for your patience and encouragement (and donations!) for keeping this project going!

1 Like

This Friday’s update is here: [RELEASE] Ask Alexa

Another Friday update…we are about a week away from another release:

Just FYI–most of all the fancy colors are completely broken. Only the basic main colors seem to be working for me–like red, green, blue, purple, etc. Things like Sky Blue, Peru, Sea Green, etc doesn’t change the color of the bulbs at all and doesn’t seem to return any errors either. BTW–those same “exotic” colors used to work.

Here is the log for "Pale Violet Red"
1:26:20 PM: debug NO Update Needed for transitionTime.
1:26:20 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:4 )
1:26:19 PM: debug newHue = 62, newSat = 0
1:26:19 PM: debug colorData from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
1:26:19 PM: debug HS from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
1:26:19 PM: debug colorData = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
1:26:19 PM: trace getHSfromRGB ( 99.99217, 100.00159, 100.02278):
1:26:19 PM: debug RGB colorData = [red:72.27135992018889, green:72.27419726850489, blue:72.28058418098786]
1:26:19 PM: trace Hue B Smart Bulb: updateStatus ( xy:[0.3227, 0.3290] )
1:26:19 PM: debug NO Update Needed for transitionTime.
1:26:19 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:4 )
1:26:20 PM: debug NO Update Needed for switch.
1:26:20 PM: trace Hue B Smart Bulb: updateStatus ( on:true )
1:26:18 PM: debug Setting level to 254.
1:26:18 PM: trace Hue B Smart Bulb: setLevel ( 100 ):
1:26:18 PM: debug Sending [transitiontime:4, xy:[0.32272673, 0.3290229]]
1:26:18 PM: debug xy from HSB = 0.32272673 , 0.3290229 .
1:26:18 PM: debug red = 5.2494684E7 / r = 65025.0
1:26:18 PM: trace colorFromHSB ( 94, 60, 100): really h 338.40, s 0.6, v 1
1:26:18 PM: trace sendToHub: no XY values, so get from Hue & Saturation.
1:26:18 PM: trace Hue B Smart Bulb: sendToHub ( [hue:94, saturation:60] ):
1:26:18 PM: debug Hue B Smart Bulb: setColor( [hue:94, saturation:60] ).

I will look into it…Thanks for the report.

Ok…just tested this and they work great on the Osram bulbs I have…every example you mentioned did not produce an error and change the color of the bulb to the values provided from the SmartThings API.

The copy and paste you put in your note…where did it come from (I know live logging), but the device itself? Are you using a hub to control your colored bulbs? And, when you say ‘they don’t work’…what exactly do you mean? Do the bulbs come come on? Are there any red messages in the live logging?

I got the following from Ask Alexa

1:43:27 PM: debug I am setting the color of the cabinet light 1 to sea green.
1:43:10 PM: debug I am setting the color of the cabinet light 1 to peru.
1:42:51 PM: debug I am setting the color of the cabinet light 1 to sky blue.

Let me get a bit more detail and we can see if it is Ask Alexa or something else…

Quick Edit: Yes–logs from the device itself, not Ask Alexa.

I’ve tried them on various Hue bulbs–including Lightstrips Plus and BR30’s. Ask Alexa always seem to say it is changing the color, but the colors don’t change on the bulb. They stay whatever color they were before or change to white. No red lines in any of the logs for the bulbs. I do see odd debug colors in the log with “…5E-4” in the saturation when calling for these colors, whereas the main colors like blue or red works just fine.

Here is the log to red:
2:10:21 PM: debug NO Update Needed for level.
2:10:21 PM: trace Hue B Smart Bulb: updateStatus ( bri:0 )
2:10:21 PM: debug newHue = 100, newSat = 100
2:10:21 PM: debug colorData from XY = [hue:0.9999992660982069, saturation:0.99999773779223]
2:10:21 PM: debug HS from XY = [hue:0.9999992660982069, saturation:0.99999773779223]
2:10:21 PM: debug colorData = [hue:0.9999992660982069, saturation:0.99999773779223]
2:10:21 PM: trace getHSfromRGB ( 352.25726, 7.968791E-4, 0.002348009):
2:10:21 PM: debug RGB colorData = [red:122.17254245389466, green:0.4881140576697502, blue:0.7969924603139141]
2:10:21 PM: trace Hue B Smart Bulb: updateStatus ( xy:[0.7006, 0.2993] )
2:10:21 PM: debug NO Update Needed for switch.
2:10:21 PM: trace Hue B Smart Bulb: updateStatus ( on:true )
2:10:20 PM: debug Sending [transitiontime:4, xy:[0.7006062, 0.29930097]]
2:10:20 PM: debug xy from HSB = 0.7006062 , 0.29930097 .
2:10:20 PM: debug red = 5.2494684E7 / r = 65025.0
2:10:20 PM: trace colorFromHSB ( 0, 100, 100): really h 0, s 1, v 1
2:10:20 PM: trace sendToHub: no XY values, so get from Hue & Saturation.
2:10:20 PM: trace Hue B Smart Bulb: sendToHub ( [hue:0, saturation:100] ):
2:10:20 PM: debug Hue B Smart Bulb: setColor( [hue:0, saturation:100] ).

Here is the log for Sea Green:
2:12:37 PM: debug NO Update Needed for level.
2:12:37 PM: trace Hue B Smart Bulb: updateStatus ( bri:0 )
2:12:37 PM: debug NO Update Needed for switch.
2:12:37 PM: trace Hue B Smart Bulb: updateStatus ( on:true )
2:12:37 PM: debug NO Update Needed for transitionTime.
2:12:37 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:4 )
2:12:36 PM: debug newHue = 62, newSat = 0
2:12:36 PM: debug colorData from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
2:12:36 PM: debug HS from XY = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
2:12:36 PM: debug colorData = [hue:0.6154037886340992, saturation:3.0602159267618245E-4]
2:12:36 PM: trace getHSfromRGB ( 99.99217, 100.00159, 100.02278):
2:12:36 PM: debug RGB colorData = [red:72.27135992018889, green:72.27419726850489, blue:72.28058418098786]
2:12:36 PM: trace Hue B Smart Bulb: updateStatus ( xy:[0.3227, 0.3290] )
2:12:36 PM: debug NO Update Needed for transitionTime.
2:12:36 PM: trace Hue B Smart Bulb: updateStatus ( transitiontime:4 )
2:12:36 PM: debug Setting level to 0.
2:12:36 PM: trace Hue B Smart Bulb: setLevel ( 0 ):
2:12:36 PM: debug Sending [transitiontime:4, xy:[0.32272673, 0.3290229]]
2:12:36 PM: debug xy from HSB = 0.32272673 , 0.3290229 .
2:12:36 PM: debug red = 5.2494684E7 / r = 65025.0
2:12:36 PM: trace colorFromHSB ( 41, 50, 100): really h 147.60, s 0.5, v 1
2:12:36 PM: trace sendToHub: no XY values, so get from Hue & Saturation.
2:12:35 PM: trace Hue B Smart Bulb: sendToHub ( [hue:41, saturation:50] ):
2:12:35 PM: debug Hue B Smart Bulb: setColor( [hue:41, saturation:50] ).

What I think is happening is something is off in the transform that puts saturation out of legal range, and the bulb defaults to white (saturation = 0) instead. So the sea green turns the bulb to white when asking for sea green and similar colors with transform errors.

I am using the Hue B Smart device handlers from @infofiend ([UPDATED 4/19/17] Hue B Smart (Smart and FAST Hue Lighting))

I think this is the common problem because I see this on colors that don’t work like sea green and pale violet red. All those XY tranforms put the hue and saturation at the same numbers, but obviously “out of range.”

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