How to use the 3PO-Labs Responder to make Alexa talk back to you
The Alexa Responder tool created by 3PO-Labs allows anyone to create customized responses from Alexa to questions about status of anything controlled by the ISY. Some examples I am currently using with this tool are:
· Alexa, Tell Me the inside Temperature (based on my Insteon thermostat)
· Alexa, Tell Me Security Status (based on my ELK)
· Alexa, Tell Me House Fan Speed (speed of my whole house fan that I run at night)
· Alexa, Tell Me Pool Pump status (linked to my Pentair pool pump)
· Alexa, Tell Me Power Usage (based on my AEON labs Home Energy Montor)
· Alexa, Tell Me ISY options (you can set this up with a help message on all the things you can ask Alexa to tell you)
NOTE: Amazon as of Aug 7, 2018 has stopped allowing the use of invocation word 'me'. So 'Tell me' no longer works. I switched to 'Bob', so now I say "Alexa, ask Bob ....". But use whatever word you want. Just no 'me' anymore.
Basically, with a little programming in the ISY, you can have Alexa give verbal updates to anything that your ISY links to or knows about. Possibilities are endless. You can chose your own command words, and decide how she responds. If you want to add humor, add references to your dog, have her talk sweet talk to you, or whatever, it is up to you. You can have 100% control of what Alexa says.
To set this up, you will need to:
Sign up for an Amazon developer account (it is free) and Create an Alexa Skill (free and easy)
Open the skill you created using your Echo in order to get the Skill ID number (for use with the ISY)
Create Network Resources on the ISY for each item that you want Alexa to respond to. You will need the Networking Module in ISY, either by purchasing it or the Portal.
Create programs on the ISY to trigger the Network Resources when things change
(Optional) Spend countless hours setting up different responses for Alexa for every conceivable thing you want her to respond to.
There is no need for any home server or Raspberry Pi, nor is there the need to sign up for the ISY Portal (which I still recommend you do anyway). So there is no additional cost for this capability.
3PO-Labs has a good summary of steps 1 and 2 for generic use, but I have tailored those instructions for use with the ISY here. Their site is: http://www.3po-labs.com/responder.html
June 2018 update: Amazon has greatly improved their skill creation tool. Upside is that it is much easier to create your own skills. However, the instructions below are somewhat out of date now. They still work, but the screens will look different and you will have to translate a few things into the way Amazon now does it.
STEP 1: Create your Alexa Skill
If you have not done so already, go to https://developer.amazon.com/edw/home.html#/skills/list to sign up for a developer account with Amazon. Select “I am a new customer” and follow the sign up process. Enter the same credentials as you use for your Echo account.
With your account created, now sign in.
https://developer.amazon.com/edw/home.html#/skills/list
Once you have signed in, select “Alexa” from the top bar, and then in the box below called “Alexa Skills Kit” select “Get Started”. This will bring you to the “Building Alexa Skills” page. Should look like this, but with no skills listed yet.
As you can see, I have already created 2 skills. Let’s focus on the “Tell Me” skill which you will want to create. Click on “Add New Skill” in the upper right. You will see this page:
This is the page where you tell let Alexa know what word(s) to use to respond to ISY commands. I will go into the many options you have here later, but for now, let’s have Alexa respond to “Alexa, Tell Me xxxx”. Fill out these 2 fields:
· Name: “Tell Me” (omit the quotes)
· Invocation Name: "me" (again, omit the quotes and do not use any caps here)
You can come back later and change these if you want to have a different way to address your Alexa.
Select “Next” in the lower right. This will bring you to the “Interaction Model” page. This is where you will tell the Skill what Intentions to respond to.
The upper area is where you define what set of responses you plan to have Alexa provide. For now, let’s put these in, but you will add to these over time.
{
"intents": [
{
"intent":"INSIDETEMP",
"slots": []
},
{
"intent": "WHATISMYID",
"slots": []
},
{
"intent": "AMAZON.HelpIntent",
"slots": []
}
]
}
And in the lower box, add these sample utterances (just copy and paste the following):
INSIDETEMP inside temperature
INSIDETEMP indoor temperature
WHATISMYID my id
WHATISMYID my id number
AMAZON.HelpIntent what you can do
AMAZON.HelpIntent what i can ask
Notice that you can change the words beside each Intent to ensure that Alexa understands your intention. These words are called sample utterances. I recommend keeping these simple and with fewest words possible. The more words you add, the more easily Alexa gets confused. Use the KISS principle.
Click on the “Next” button in the lower right. This will bring you to the Configuration page.
Click on “AWS Lambda ARN”, select “North America”, and fill in the box with:
arn:aws:lambda:us-east-1:413543783734:function:ASK_Responder
Click on “Save”.
Congratulations. You created your first Skill! Probably, this is the only skill you will need. But you will be coming back and editing/adding to this skill many times in the future.
STEP 2: Register your new Skill and get the Skill User ID number
Activate the skill so the server will record your Echo ID and give it back to you. Talk to your Echo and activate the skill:
"Alexa, Open Me"
If this is the first time you have accessed this skill, it should then respond with your Echo ID, and a series of instructions on how to use it. Your ID is a unique identifier that will look something like this (0fabacdd-d3ea-48a7-98bc-7d518a19b7c1). You will want to copy/paste it out of your Alexa App so you can use it later. Remember, if at any time you forget what your ID is, you can always ask the skill
"Alexa, Tell Me what is my id?"
Remember when we were setting up the Skill and had the Intention called WHATSMYID? Well, that is why we added that so you can get your ID again in the future.
STEP 3: Set up Variables and Network Resources in ISY
First, since we will be asking Alexa to tell us Temperature, we will need to have a variable for Temperature. In this case, I am using State Variable #17 to hold temperature from my Insteon thermostat. Note that in ISY, variables can be accessed using the format “${var.2.17}” where 2=state variable and 17=variable number. We will use this format later.
This next step will require you to have the Networking Module. If you are using the ISY Portal, you will already have this. If not, you must purchase the Networking Module from UDI. What you will be doing is creating the words that Alexa will speak back to you when you ask her a question. We will do two of these to start off. You can add more as you need.
In ISY, select “Configuration”, “Networking”, “Network Resources”. Select “Add” at the bottom. A new line will be created. Give it a name such as “Inside Temperature”. Then click on the column to the right of the name, and it will open a new box. Here is what my Temperature example looks like:
Most of this you can see from this image capture, but for clarity:
Host = responder.3po-labs.com
Port = 80
Path = /responder/users/userID/intents/INSIDETEMP
Replace userID with the long number you got at the end of step 3). So the actual Path will look something like:
/responder/users/0fabacdd-d3ea-48a7-98bc-7d518a19b7c1/intents/INSIDETEMP
As you may notice, the end of the path includes the ‘intent’ term that we used in the Alexa Skill and matches the Sample Utterances which will trigger this response.
Select Content Type: application/json
NOTE: As jndsoccer discovered, it might be better to use "Raw Text" rather than "C Escpaped" setting. Raw Text will maintain the format of the body posted below and will allow for easier editing later. C-Escaped puts everything on one line after you save it, making editing a bit more complex. But either will work.
In the body, paste the following:
{
"version": null,
"response": {
"outputSpeech": {
"type": "SSML",
"id": null,
"ssml": "<speak>The current inside temperature is ${var.2.17} degrees. </speak>"
},
"card": {
"type": "Simple",
"title": "Inside Temperature",
"content": "${var.2.17} degrees"
},
"shouldEndSession": true
},
"sessionAttributes": null
}
Of course, change the ${var.2.17} to whatever variable you have put your temperature in. Then select Update, then Save.
And while we are here, let’s create a second Network Resource as a HELP function. Similar to that above, but change the path to:
/responder/users/userID/intents/AMAZON.HelpIntent (again, putting your userID in)
And put this in the Body:
{
"version": null,
"response": {
"outputSpeech": {
"type": "SSML",
"id": null,
"ssml": "<speak> I can provide the status of the following devices in your home. . . House Fan speed, Security Status, Pool Pump Status, power usage, inside temperature, and outside temperature. Just say, tell me, followed by the item.</speak>"
},
"card": {
"type": "Simple",
"title": "Help",
"content": "Help"
},
"shouldEndSession": true
},
"sessionAttributes": null
}
This is directly from my program which includes these other commands. If you choose, remove everything except for Inside Temperature for now until you add more. Or leave as it just for experimenting.
Notice also the section called "card". This will cause a note to be sent to the Alexa App so that you can debug the speech if needed. This section is optional.
Again, select Update and then Save.
Back on the main Networking Resource page, click SAVE to save the 2 resources we just created. Select the name of each resource and click TEST. Do the same for the other resource. This should give you a dialog box like this:
If you do not get the HTTP/1.1 200 OK, then you did something wrong with the network resource. Go back and check everything.
Now let’s see if these really worked. Say to your Echo:
“Alexa, tell me what you can do”
You should get the response that you put into the body of the HELP network resource.
“Alexa, tell me inside temperature”
You should get a response of the inside temperature. If your variable was not populated with a program, it might just say zero.
STEP 4: Create programs to update Variables and trigger the Network Resources in ISY
I won’t go into detail on this step, but you can now create programs that will update any variable you are using and have the ISY send the updated information to Alexa by triggering the Network Resource. The key thing to understand here is that you need to send an update to Alexa every time something changes that you care about. So if the temperature changes, you need to update Alexa. Here is my program to do this:
If
$Inside_Temperature > 0
Then
Resource 'Inside Temperature'
Else
- No Actions - (To add one, press 'Action')
This will cause the resource to be updated on any temperature change.
THIS IS VERY IMPORTANT: If you are using variables, the Echo has no idea that a variable has changed and will continue to give you old/stale data when you talk to her. It is up to you to send to the Echo, using the network resources you created, the latest updates and variable states.
STEP 5: Add more Intents!
Now that you have the idea, go back and add more Intents! Here is what my Alexa Skill looks like right now:
Intents:
{
"intents": [
{
"intent":"POOL",
"slots": []
},
{
"intent":"INSIDETEMP",
"slots": []
},
{
"intent":"OUTSIDETEMP",
"slots": []
},
{
"intent":"POWER",
"slots": []
}, {
"intent":"SECURITY",
"slots": []
},
{
"intent":"WHFAN",
"slots": []
}, {
"intent": "WHATISMYID",
"slots": []
},
{
"intent": "AMAZON.HelpIntent",
"slots": []
}
]
}
Sample Utterances:
AMAZON.HelpIntent what you can do
AMAZON.HelpIntent what i can ask
POOL pool pump
POOL pool pump status
POOL pool pump speed
POOL poupon
POOL poop
INSIDETEMP inside temperature
INSIDETEMP indoor temperature
OUTSIDETEMP outside temperature
OUTSIDETEMP outdoor temperature
POWER power usage
POWER energy usage
POWER home power
POWER house power
SECURITY security status
SECURITY security
WHFAN house fan speed
WHFAN house fan status
WHFAN fan speed
WHFAN fan status
WHATISMYID my id
WHATISMYID my ID number
One of my most used responses is "Alexa, tell me security status". I have programs set up to update my security status based on my ELK and other sensors. For example, one program is:
House Secure and outside lights off - [ID 00AB][Parent 00AA]
If
Elk Area 'Main House' 'Arm Up State' is Ready To Arm
And '@ Z-wave Devices / ZW 09 Garage Door Lock' Status is Locked
And '@ Z-wave Devices / ZW 22 Front Door Lock' Status is Locked
And '@ Z-wave Devices / ZW 23 Den-Garage Door Lock' Status is Locked
And Status (Old) '@ Inside Devices / Den Sliding Door Unlocked' is Off
And Program 'Test Exterior Light On?' is False
Then
Resource 'Alexa House Security secure '
Else
- No Actions - (To add one, press 'Action')
and then I created a network resource for this program called Alexa House Security Secure:
{
"version": null,
"response": {
"outputSpeech": {
"type": "SSML",
"id": null,
"ssml": "<speak>Your house is secure. All doors are locked and all windows are closed</speak>"
},
"card": {
"type": "Simple",
"title": "Security Status",
"content": "House is Secure"
},
"shouldEndSession": true
},
"sessionAttributes": null
}
In all, I created about 6 of these for various states of secure / not secure. You can do that same thing for queries such as "Alexa, tell me what lights are on", for example. Note that in these cases, there are no variables used. You only use variables when they make sense to use.
But you can add just about anything you want. After updating the Skill list of Intents and Sample Utterances, just add the Network Resource to go with it and you are set!
BTW, notice my sample utterances under POOL. This is for my pool pump status. For some reason, Alexa gets very confused when I say "Tell me pool pump status". If you go into the Alexa App, you can see what words she THINKS you said. She always thinks I said "poupon" or "poop on" rather than Pool Pump. So rather than argue with her, I just added those into the list so that she understands me intent. And it works!
About 3PO-Labs:
I cannot thank the kind folks over at 3PO-Labs enough for making all of this possible. They originally created the Responder tools to allow developers to more quickly test how Alexa speaks sample text phrases to see if they sound right. When I let them know about how we wanted to use this in our home automation world, they enthusiastically responded by expanding the tool and customizing to our needs. I recommend that people read their blogs and support them in any way you can.
http://www.3po-labs.com/
About Alexa Syntax:
I am not an expert on this, and probably have some of the terminology wrong, but here is what I have learned so far. Let’ use an example:
“Alexa, Tell Me the Inside Temperature”
Wake Word: Alexa
Action Word: Tell
Invocation Name: Me
Intention: Inside Temperature
For wake word, there are (maddeningly) only 3 options today. Alexa, Amazon and Echo. Hopefully Amazon will allow more soon.
For action word, there are quite a few. You are already familiar with actions such as ‘Turn On’, ‘Turn Off’, etc. For our custom skill, the Action words available to us include:
· ask
· begin
· do
· launch
· load
· open
· play
· resume
· run
· start
· talk to
· tell
· use
For Invocation Name, we have (almost) complete control. I chose 'Me" but you can choose whatever you want. But it has to pair nicely with the Action Word you decide to use. For me, logical pairs are:
“Tell Me” EDIT: note that as of Aug 7 2018, we can no longer use 'me'. Amazon stopped allowing use of 'me' for some reason.
“Ask Izzy”
“Ask ISY”
“Ask House”
But you can use whatever pairs work for you. One downside for my choice of "Tell Me" is that it prevents you from doing other Alexa skills that also use this pairing. For example, you cannot use the "Alexa, Tell me a joke" skill. The custom skill you have created will always take precedence over other skills. So just be aware of that.
The Intention word(s) can also be anything you want. You can (and almost certainly will) have many of these. One for each item you want to get a response for. Each Intention Word will be associated with one or more Network Resources on your ISY. For each Intention Word, you will create a list of “Sample utterances” that the Echo will use to do its speech recognition. So for the Intention Word “Inside Temperature”, you can add sample utterances such as “inside temperature”, “what is the inside temperature”, “the current inside temperature”, “the damn inside temperature”, or whatever.