[Deprecated] Ask Alexa 2.2.1


(Micheal ) #1

Announcing version 2.2.1 of Ask Alexa

I am pleased to announce I am ‘back’ continuing the evolution of Ask Alexa. This version, which minor on the surface, puts in place a structure that will allow for more features in the future. So, ALL aspects of the app have changed and it is required that you update your Lambda code, your developer are, and the SmartApp (in that order).

PLEASE NOTE: Now that this app is rather stable now I will be updating it less frequently except for bugs and new features. I am waiting for Amazon to release their ‘push’ notifications where some amazing stuff will happen with this app. Until then, if you do have a great feature idea for this app, however, just let me know.

Other additions to this new version include:

  • Bug Fixes - The normal things…silly misspellings, logic errors, bug reports.
  • Code Optimization - Always finding better ways to do things in a shorter about of code.
  • Color Schemes - There have been many requests for all sorts of color enhancements, mostly to add more of the standard SmartThings colors. To save some room in the code and to conform with other smartapps, I have added access to the colors referenced internally by SmartThings. This means there are literally close to 150 colors to choose from! Use the cheat sheet for a list of all of the colors and ensure you populate your developer slots with these new colors. Of course, if you want your own personalized color that option is still available.
  • Additional Security-Thanks to @Cherokee180c for this suggestion. Basically, if you have locks or garage doors in your profile they can be open or closed easily…sometimes TOO easily that children could inadvertently open a garage door or unlock a door. While there is a PIN option for this, some people want the ability to only do ONE of the commands and not the other (i.e always allow voice to close the garage door, but not open it). You can now disable specific commands for these devices to prevent their usage by voice. So, you could disable “open” for the garage door, and “unlock” from the locks…or vis versa…you could disable “close” or “lock” if you desired.
  • Additional utterances - Additional utterances focusing around the colored lights have been added.
  • Better Follow ups - One item that I was recently motivated to look at is the follow up routines. Basically, if you don’t include your password with an item that needs a password, you had to issue the long command all over again…Now, using the password example, if you say “Open the garage door” and it requires a password, you can just follow up with “Password: 1234” after the error prompt and Ask Alexa will remember your previous request and apply the password to the command and open the garage door. So something like this:
    Alexa, tell SmartThings to Open Garage Door
    Sorry, this command requires a password. Say password and your PIN
    Password 1234
    I am opening the Garage Door.
    Now that this structure is built into the code you can expect more follow up items within Ask Alexa. Thanks to @SBDOBRESCU and @bamarayne for motivating me to look into this further. Good suggestion!
  • Consolidated Reporting - Added an option for switch and dimmer consolidation reports. For example, if all of the switches are off you have the option of having Alexa say “All monitored switches are off” instead of listing all of the monitored switches and their status. This will shorten the final report for some of you. Great suggestion by @jseaton
  • Internal Framework upgrade Added an additional set of options when using control macros and setting up SmartThings devices. More is being developed in this area, but this already allows you to have more of a conversation with Alexa instead of barking commands. Think of the recipes for Google Home and IFTTT (custom commands and responses). More to come in this area, so watch for future releases!
  • Multi-Room Setup While not technically a new feature, I recently had a use case that let me examine how to get a multi-room experience using one Alexa account with multiple devices in different rooms. Basically, it comes down to multiple Lambda functions, tied to multiple developer skills (with different invocation names), with multiple versions of Ask Alexa. I have begun documenting this here: http://thingsthataresmart.wiki/index.php?title=Ask_Alexa#Multi-Room_Controls_.28Advanced.29

Installation
For those with IDE integration with GitHub, simply update the repository and you will have the latest code for the SmartApp itself. However, ALL aspects of the application need to be updated, so place follow the original instructions for installation to ensure you get everything updated properly:
The wiki for this app is here: http://thingsthataresmart.wiki/index.php?title=Ask_Alexa

From a high level, here is the order to upgrade to the new version:

  • Overwrite the Lambda code with the new version. Be sure to retain your Oauth and Token
  • Overwrite the intent code
  • Overwrite the utterance code
  • Overwrite the SmartApp IDE code
  • Open the SmartApp on your mobile device and go through the Settings>>Setup Variables process

Support
All of you have been great in asking very relevant questions and making suggestions that I end up using. Here are some helpful tips on usage and support:

  • Sometimes it works best if I can work real time with you. To facilitate this, I have created a Slack channel: https://askalexa.slack.com. Using this tool is easy and will allow for real-time collaboration to solve the problems faster. To use this feature, I must invite you to the Slack channel. This will not be for normal questions; please use this forum for that function.
  • The Echo, as it is designed currently, cannot react to switches opening or other actions within SmartThings. She will do things for you, but only at your direction and at the time of the request. The delay timer mentioned in the control macro happens at the SmartThings hub, not within the Amazon Alexa control. See the new Message Queue functions for similar functionality.
  • When evaluating new features I will typically ask for a valid use case. If it can be used by others to bring them value I will put it on my list of future revisions. Not all suggestions will be used and many times I add aspects of the request.
  • There are no dumb questions, but many of the questions you may have were probably answered in the year since the initial release. Please take some time to go through the forum and the wiki if you have issues. And don’t be offended if I give you the specific area of the manual that answers your question. I have spent almost as much time on the documentation as I have on the app. Finally, there are some big fans of Ask Alexa that know almost as much as I do. They can also help.
  • Feel free to send me forks of utterances or even code revisions. As mentioned above, if it adds value to the overall program I will try to include it. This also goes for the wiki documentation…while I have spent about 120+ hours creating that document, I am open to it being improved; I know there are grammatical errors or syntax issues…If you find them, fix them…I will include your name (if I can) in any fixes submitted.
  • If you find a bug or a consistent crash please help me track it down by giving me repeatable steps to reproduce it. A non-reproducible bug, many times, indicates other areas that may be at fault besides the app. If you watch the live logging and see a red error with a line number, that is very helpful to me! However, I will need a full screenshot and not a copy/paste of the text. But be careful about revealing your OAuth and AppToken in your public posts. People can control you house with that information. May want to blur that out.

As mentioned above, revisions will be less and less now. And with the code base now unified, I expect less and less additions…especially as we integrate CoRE more to do some of the heavy lifting of larger condition-base automations… Any and all suggestions are still on the table for addition.

As always, I appreciate any public accolades or even donations to my PayPal account: https://www.paypal.me/mstruck . And, if you are so inclined, I also will accept bitcoins (or fractions thereof) if you have any laying around. My wallet ID is: 1CMgaiKgBfojTBCLpHLfa9KvcrW3cNxVpm
Enjoy.


[RELEASE] Ask Alexa
[Depricated] Ask Alexa 2.2.0
(Bobby) #2

Nice work! It’s good to see you are changing your approach on how to interact with Alexa…

‘Using a control macro, you can simulate a little bit of intelligence using Ask Alexa.’

I’ve only tried to convince you to add ‘smarts’ to AA since Keith @N8XD got us started with his Ask Home …

I am really glad to see you back making updates to AA.

Welcome back!


(Micheal ) #3

Thanks! Actually, it is not a change in approach at all. From the beginning I had the framework to do a lot of the things I am now expanding on…For example, a user has always had the ability to create ‘conversational’ macros (i.e. “it is too bright in here” and have the result be the lowering of the dimmers). The rooms idea, in addition, has always been an option by changing one line in the code to allow for multiple instances. It is only after having a true use case to demonstrate this that I decided to document it so others could benefit of it.

I appreciate the comments, but feel Ask Alexa has always had the Smarts…but now is growing up to show what she can really do.


(Marc Connors) #4

Hey Michael…as always great work here. I was doing the updates and in Lambda I get this error with the new code: The role defined for the function cannot be assumed by Lambda. Any ideas where I didnt follow your always spot on instructions. Clearly its a user error! :wink:


(Marc Connors) #5

ACtually figured part of it out already…didn’t put in my cut and paste code in the lambda code. Now I get this…Your role is not ready, or cannot be assumed by Lambda. Please wait up to a minute and try again.


(Micheal ) #6

I have never seen that before…Where exactly are you seeing this? In the Lambda code area, the developer site, or somewhere else?


(Marc Connors) #7

Well it was in the Lambda site…now I see an error
{
“errorMessage”: “RequestId: xxxxxxxxxxxx Process exited before completing request”
}
I get this when I hit test in the Lambda Managment Console


(Micheal ) #8

You never test in the Lambda area…I probably need to document that, but that data is meaningless and you will always get what looks like an error unless you know exactly what to look for. The copy/paste process is rather straightforward, and the best test is to use your Alexa to attempt to control a light. If that doesn’t work, you will use a combination of the live logging in the IDE and the developer site.

Let me know if that helps.


(Marc Connors) #9

Ok I just saved everything and then Asked Alexa, tell Smarthings turn on arcade (which is a CoRE piston) and it worked. I guess I am all up to date now and working with the new code. I thank you for that! I do have another question. On the Slots…the one called Follow Up, what commands do you put under that one?


(Micheal ) #10

That should be generated and displayed when you run the Setup Variables…however, it will only have two entries…password and PIN (both lower case).


(Marc Connors) #11

Thanks…well now I ask Alexa, ask Smarthings status of garage lock and I get I had some problems finding the device you specified. in the logs for Ask Alexa I get Num: undefinied, param: undefined, op: lock, dev: garage


(Marc Connors) #12

And it keeps getting more interesting…I have several Alexa switces that I created with Alexa Helper, but now when I go into that application, it looks like Ask Alexa and I don’t see where I can add switches anymore. Plus when I say Alexa turn on Speakers, that should use an Alexa switch that turns on a Wemo plug, in the Smartthings app it shows that it turn it on, but nothing happens. Really confused now


(Marc Connors) #13

I see this in the logs under Alexa Helper:
Access Toekn not defined. OAuth my not be enabled. Go to SmartApp IDE settings to enable OAuth
However, in the IDE it is enabled. In the iOS Smarthings app under My Apps. I enabled it again, and now that works. But the bigger problem is in iOS, I see Alexa Helper and Ask Alexa apps. But now they are exactly the same, meaning my ALexa Helper app looks just like Ask Alexa. I have verified the code and it is correct for helper, I am really confused


(Micheal ) #14

Ask Alexa is completely different and has no need for Alexa Helper. You don’t need to define switches in Ask Alexa as you can use your own existing physical switches…For your garage door you may be running into a issue because “lock” is a reserved word.

I recommend going through all of the documentation as all of the concepts for Ask Alexa are different than Alexa Helper.

Sorry for the confusion.


(Micheal ) #15

Reading though your note again it appears you are indeed confusing Alexa Helper with Ask Alexa. They are separate and should be treated as such. Let me know if you have any luck with getting Ask Alexa to work and reach out if you have difficulty.


(Marc Connors) #16

Hi Michael thanks for your quick replies. Ok, to clear things up. I started with Ask Alexa today to update it with 2.2.1. I ran into a few issues updating it. Specifically with the lambda part of the update. I sorted through those issues and it works as expected now. The second issue that came into play is Alexa Helper. I had not touched that code at all. However when I open the SmartThings app on my iPhone post update to Ask Alexa, I noticed that the icon for Alexa Helper looked like the icon for Ask Alexa. Sure enough when I opened the app titled Alexa Helper it was Ask Alexa. So now I have two Apps in SmartThings one called Ask Alexa and Alexa Helper (which is what I started with at the beginning) but now both were Ask Alexa. So I went into the IDE and got another copy of the groovy code for Alexa Helper and published that code again. Went to the MarketPlace on my Smartthings app and under My App, res-setup Alexa Helper. Unfortunately, all my Alexa Switches and Scenarios that I had in that app were all gone. I got most of the important ones back and just adding them as they come up. So all in all I am back with both apps up to date and working as expected. Sorry for the long explanation and the confusing posts before hope this clears it up. Thanks again for everything!


#17

Nice job Michael!

I’ve found several invalid colors so far:

  1. Alice Blue
  2. Indian Red
  3. Navajo White
  4. Peru

Also, the color “Snow” is actually “Red” rather than “White?”


(Micheal ) #18

When you say invalid you mean that when you call those colors they show up completely different? I have heard reports of this, and unfortunately, the colors come directly from SmartThings through an API call with the new version so I have little control of how the colors appear unless I put them back into my code manually I am looking into it and will attempt to work with SmartThings to resolve.


(Micheal ) #19

Marc,

You get the prize for having the strangest issues this week. Again, I think this all stems from an underlying account issue you are having as you had that indication with not being able to delete the apps. I would be very careful and actually contact SmartThings to ensure they look at your account to make sure all is in order. You may run into issues later if there are still issues.

However, on the good side, you got through it from the sounds of it. Great work!


(Mark Kaplan) #20

why do the Thermostats show only valid commands are Open, Close, Status and open, close, status, Home, away, Sleep, Resume when Ecobee Specific Thermostat is turned on.

How do I tell it to increase or decrease setpoint. Are the Open, Close Commands mislabeled?

Thermostats (Valid Commands: Open, Close, Status)

Eco Addition
Eco Laundry
Eco Living

Thermostats (Valid Commands: Open, Close, Status, Home, Away, Sleep, Resume Program)

Eco Addition
Eco Laundry
Eco Living