[NO LONGER SUPPORTED] Ask Alexa

In live logging in SmartThings IDE I see this;

2d3fadc8-cdc4-45e3-97c7-7f893e5e8fe8 ‎8‎:‎35‎:‎56‎ ‎PM: error groovy.lang.MissingMethodException: No signature of method: java.lang.Boolean.contains() is applicable for argument types: (java.lang.String) values: [Primary Message Queue]
Possible solutions: toString(), toString(), toString(), notify(), toString(boolean) @ line 3450

Ok nevermind. It just magically started working fine?

SmartThings​ has been having issues of late, so I am glad it started working. However, your issue was related to the variable issue that creeped into this version that I finally fixed. It is non fatal so I don’t plan to patch it but simply let the users change the settings on the Message queue page which will resolve it…The good news is that I know what caused it and can prevent it in the future.

Awesome. As always, thank you very much for all your hard work on a great product!

1 Like

With it being Friday I wanted to send out a little something since there is no update for this week. In getting some feedback from some of you, you mention that many programs (especially skills) update TOO often. I will make sure I meter these, but wanted to give you a heads up of where I am going…

For those that have been following this thread over the past year, you know that Ask Alexa is quite mature now. However, I still have a lot we can do with this! I have built a framework to allow for some new changes/products coming Amazon soon, and that gave me some great ideas on how I can evolve Ask Alexa even further. Some of you have wondered if this means that you will need to wipe out and re-install Ask Alexa in the future. The good news is no…there was only ONE instance where I had the user base do that and that was almost a year ago! While there are no plans to ‘wholesale’ have you re-install (and more importantly, re-create your configuration), there are changes that are coming that will give better performance, so those aspects may need to migrated to the new framework. Therefore, I wanted to publish a high level roadmap of where I have Ask Alexa going. This will allow you to prepare for the changes and allow you to smoothly migrate from version to version.

2.2.5-This change will move the weather reporting from the voice reporting macro to their own ‘extensions’. In polling a few members, many times you don’t include weather reporting with your device reports, so separating them makes a lot of sense. For those that DO want weather reporting as part of an overall voice report, you DO NOT lose this functionality. Weather reports (and voice reports) will be easily accessible via pull down selection, or even a text variable function. The pull down concept is straightforward and allows you to pick and choose which reports you want to include. The text variable is for more advanced users. Say, for example, you create a great weather report call “My Home”; you simply add this variable to the pre or post message text field as %my home% and the weather report will play before or after the rest of the report. In addition, Flash Briefing allows for weather reporting. Simply say “Alexa, flash briefing” and you can choose a weather report to play as part of your flash briefing. Finally, the weather reports can be part of a whole list of reports and actions that can happen with one command. Previously called “Macro Groups”, I renamed this “Extension Groups” that allow for multiple macros and extensions to be called and run in sequence. I personally use this for my good night routine. Coupled with restrictions, the correct extensions will fire based on weekday/weekend configurations.

Voice reports will also be moved to an extension as well. And you can embed voice reports within voice reports. These are the biggest ‘heavy hitters’ in the current Ask Alexa code and removing these will give a 10-20% increase in speed in Ask Alexa reacting and reduce the size of the code by 25%!

2.2.6-In this version I will add a scheduling extension. This will allow you to do a ‘poor man’s calendar’ with Ask Alexa sending ‘reminders’ to the message queue, allowing you to get visual and audio notifications of reminders (and when Amazon push notification comes around, via this method as well). Use cases include reminders for birthdays, anniversaries, or even to take out the garbage. However, the main power of this will be dynamic scheduling of other extensions. For example, using the weather function, you can create a schedule to send an weather advisory to the message queue (giving audio/visual/sms notification) at regular intervals when bad weather is approaching. These will be created in the app (for now, not voice) but remind you via Alexa or other notifications set up in the message queues.

2.2.6 - 2.3.0 It has been communicated with partner developers that the primary message queue would be deprecated in lieu of the new, user-created message queues. About ½ of the partner apps out there already have committed to migrating to this new strategy, and by 2.3.0 this built-in queue will no longer be present. The FORWARDING of incoming message that were intended for the Primary Message Queue will still work for any developers that have not updated.

These changes will allow me to develop an ability to VERBALLY leave messages into specific queues. This will require some Lambda and developer work. Current implementations of this feature elsewhere, while functional, do not follow best standards from Amazon. Instead, I will follow the developer recommended strategy for implementing a version of free speech recognition.

In addition, the message queue functionality will be expanded. While current versions allow for partner apps to delete files, there are certain use cases where you only need one version of a current message (think apps like Device Manager or Big Talker). For example, you may not need multiple alerts when a device goes off line…only the latest version. Developer options will be available that allow new messages to delete all but the current message from the queue. As always, the users will have full control over what external apps can and can’t do within the queue.

2.3.0 + Future versions will remove the forwarding ability from the message queues, assuming all partner developers implement the ‘direct to message queue’ framework. In addition, depending on the success of the free text functionality, Ask Alexa will expand on this to prepare for:

3.0.0 This version will be christened when Amazon releases these push notification functionality. This will allow me to release the first subscription/monetized extension to Ask Alexa. Details will be withheld at this time, but this app is being developed right now in anticipation of this release. Ask Alexa (as a base app) will ALWAYS remain free, however, this extension will require me to maintain a server and a few services, hence it will be a subscription model.

So there you have it. In the next few days I will post instructions/guidance to help those users affected by moving the voice/weather reporting to extensions.

Thanks again for everyone’s support and encouragement!

9 Likes

This may be fairly obvious, but after some fiddling I found that if an alias not unique from a device then you can get some unpredictable results.

For example if I have the device “foyer” (motion sensor) and alias the temperature sensor to “foyer temperature” if I say “ask smartthings about foyer temperature” the request will be:

    "Device": {
      "name": "Device",
      "value": "foyer"
    },

Which will either return the motion sensor value or “multiple matches”. I’m not sure if your documentation says that aliases can’t be superset of devices and I missed it, but I wanted to pass along my finding.

Thanks…It is documented and I probably need to add a bit more logic inside the code to at least alert the user to it.

Thanks for reminding me!:joy:

1 Like

It looks like room names also cause alias issues. I have a room “Basement Stairs” and a temperature sensor “Basement Stairs Temperature”; Alexa says that I have multiple matches on that, but the non-aliased “Basement Stairs Movement” motion sensor seems to work fine.

You should also run these tests with the simulator. The issue actually appears that it is not hearing the full command. It is hearing “basement stairs”, but not the second part. You can confirm this by watching the live logging. The command (or its subset) will show you what was heard. By typing it in the simulator it won’t be an issue with missing a word.

Either way this does need to be documented better, but in my testing it does work even with similar names, but if it misses a word it will go to the next best match.

I did try the simulator. To double check I put things back the way they were:

LIST_OF_DEVICES

garage sensor
foyer
basement stairs sensor
message queue
messages
message
queue
garage temperature
garage movement
basement stairs temperature
foyer temperature

Alexa device list.

Alexa foyer temperature test

In 2.2.4+ you will not need the message queue, messages, or message in your LIST_OF_DEVICES…

The issue with Foyer is that ‘temperature’ IS a reserved word…If you change Foyer ‘temperature’ to ‘temp’ that might work better. Same with the others that have ‘temperature’ in the name. Sorry I didn’t spot that earlier.

Is temperature reserved in alexa or smartthings? I know alexa has a bunch of reserved words but I thought the “Ask Smartthings” bypasses alexa reserved words and sends the rest of the text to Smartthings without evaluation. I’ve run into the same thing with Harmony and they have two skills to get around some of those issues.

I’ve found that if I change foyer to foyer sensor then foyer temperature starts working correctly

Foyer Temperature now works.

Temperature is used by Alexa and by Ask Alexa, but in different ways. Let’s put it this way…it is best practice not to call things by their actions. For example. a switch should not have ‘on or off’ in it. Where you get into the grey area is when you use items like sensors or temperatures in the names. As you found, they do work (sometimes), however, if it misses a word you may get an unexpected result (for example, ask for just temperature or sensor and see what happens).

Either way, the system CAN be picky…if you found something that works, however, stick with it!

1 Like

I’ve followed the instructions on thingsthataresmart wiki, but when I goto test I’m running into issues. Does the custom slot types order matter? In the intent schema, list of operators is first but under my custom slots its not? I don’t know what else could be wrong. Also typing ‘smartthings’ in front of the command doesn’t help either. Do I need to type the whole thing ‘Ask alexa…’ in the test box?

This is what I get in Lambda Request Box:

{
“session”: {
“sessionId”: “SessionId.b06b3e07-dfed-4da9-b00d-bcc3a3571637”,
“application”: {
“applicationId”: “amzn1.ask.skill.0756cf47-cb69-4d81-98a3-47d0f5252f70”
},
“attributes”: {},
“user”: {
“userId”: “amzn1.ask.account.AF45KWDT5UL2PNHIXTEXPJEDAQLQL5QQU4EYKOT7HFO3AHEU3XPK6JRCRJGZJ4XESBCXQVUWHZHEUFOCN62BZ4AKH7TSCZMO2U453JSDTIH3D3GPHJKVVILL6UJIV6GVEUSH4G6LEMJPAT4I6C3LSMBKREHRHBVBCJLX5OX7SPXVRFIG544J4YDHWWWEVLEE6XSVWY3WZMR3PHQ”
},
“new”: true
},
“request”: {
“type”: “IntentRequest”,
“requestId”: “EdwRequestId.275ee16e-77e2-4ad0-802c-d8c2bb5f3271”,
“locale”: “en-US”,
“timestamp”: “2017-04-19T02:17:20Z”,
“intent”: {
“name”: “DeviceOperation”,
“slots”: {
“Operator”: {
“name”: “Operator”,
“value”: “off”
},
“Device”: {
“name”: “Device”,
“value”: “door couch”
},
“Num”: {
“name”: “Num”
},
“Param”: {
“name”: “Param”
}
}
}
},
“version”: “1.0”
}

To answer your question, the order in which you enter the slots does not matter. They will alphabetize themselves when you save the page. In addition, it makes no difference what order the items are in the slots.

For the developer area, you do not have to do “Alexa, tell SmartThings”. From the context of the command line on that screen just assume that has already been said and you are simply issuing the commands like “Turn on the living room” or “Front door status”.

If you are having issues, let’s start with something easy…simply type ‘help’ in the command box…what do you see in the IDE live logging (in SmartThings) or on the right panel of the simulator? The left side of the simulator is helpful after you get things working…right now it just tells me that you issued a command to turn the door couch off. Is that a device in your home?

Thanks for the info. Yes ‘door couch’ is one of my Z wave outlets. This is what I get when I type help ‘The remote endpoint could not be called, or the response it returned was invalid.’

Ok…that is easy…the Oauth and/or Token may be incorrect in your Lambda code. I would follow these high level steps with using the documentation to guide you into the details:

  1. Verify you have Oauth turned on in the IDE for Ask Alexa (the main app only)
  2. Go to Settings and reset your token
  3. Go to About Ask Alexa (very bottom of the main menu)…make sure the Access Token and Application ID show up on that page
  4. Go back to Settings and Setup Variables…Copy the 3 lines at the top of the screen to your Lambda code. Save the code

Type ‘help’ in the developer area…you should see something other than before.

Be sure NOT to try to copy these by hand. Best to be on a PC and go to Live Logging to get the full address of the setup variables page…then simply copy/paste from one web page to another.

Let me know if that helps:

http://thingsthataresmart.wiki/index.php?title=Ask_Alexa#Finalizing_The_Function_Code

Great thanks man, this is what I get now, I think it’s set up right now.

“response”: {
“outputSpeech”: {
“type”: “PlainText”,
“text”: "With the Ask Alexa SmartApp, you can integrate your SmartThings household with me; this will allow you to give me commands to turn off a light, or unlock a door. For example, you can simply say, ‘tell SmartThings to turn off the living room’, and I’ll turn off that device. In addition, you can query your devices to get information such as open or close status, or find out the temperature in a room. To use this function, just give me the name of the device. For example, you could say, ‘ask SmartThings about the patio’, and I’ll give you all of the common attributes with that device, including battery levels. For those who are curious, you are running SmartApp version 2.2.4a, and version 1.2.4 of the Lambda code, both written by Michael Struck. "
},
“card”: {
“content”: "With the Ask Alexa SmartApp, you can integrate your SmartThings household with me; this will allow you to give me commands to turn off a light, or unlock a door. For example, you can simply say, ‘tell SmartThings to turn off the living room’, and I’ll turn off that device. In addition, you can query your devices to get information such as open or close status, or find out the temperature in a room. To use this function, just give me the name of the device. For example, you could say, ‘ask SmartThings about the patio’, and I’ll give you all of the common attributes with that device, including battery levels. For those who are curious, you are running SmartApp version 2.2.4a, and version 1.2.4 of the Lambda code, both written by Michael Struck. ",
“title”: “Ask Alexa Help”,
“type”: “Simple”
},
“shouldEndSession”: true
},
“sessionAttributes”: {}

Perfect!

You should now be able to control your home!

Looks like you have the current versions, be sure to read up a few posts above and find the roadmap on where I plan to take this app…Some exciting stuff coming up.

Let me know if you have any questions!

Yea man saw it earlier. It looks awesome, can’t wait to see it. You’re a real asset to this community, I’ll send some beer/coffee money your way later

1 Like