Charmed Quark Systems, Ltd. - Support Forums and Community

Full Version: New Amazon Echo Support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Bugman Wrote:Has anyone put together a macro for either the Set or Query that they could share as examples?

I've never written one so would like to see how it's done. Thanks in advance!

I found Global Actions are much easier than macros.
Bugman Wrote:I can help get you set up, at least to getting Global Actions up and running. Have you tried setting up the Amazon side yet (skill creation in Amazon)? Also need to open up a webserver port in your router so that the skill can get to the CQC webserver. I assume you had the webserver installed durng cqc setup and you have a port (I don't use the 80 default as it interferes with other stuff). You can PM if you wish.

I could use some guidance in getting the Amazon part working.

I have the v4.7.5 Installed
Set up port to other than 80
Forwarded the port to the my MS

Have A Lambda function defined using a paste of Deans post above except changing the TarAdd and TarPort to mine.

I get an error when I test it that says:
"Exception: TypeError: Cannot read property 'application' of undefined"

After this I am lost.
If you are testing it in the Lambda console, then you have to create a test event to drive it. You are just feeding it dummy info basically. Creating such events is one of the things under the Actions button. But the ones it creates are just samples and you have to modify it to match what the CQC javascript wants.

I wouldn't bother at this point. Just go ahead and set up the skill info at the other page, and give it a test via the Echo itself and see how it goes. As long as you do that, the javascript should work fine as is. If not, I can create a sample event to use for testing.
That's where I am lost, setting up the skill event. I watched the blog video, but he didn't go into detail about actually setting up the skill.

I got the Lambda function to run without an error
There are two separate web sites. The Lambda one is where you set up the javascript. If you watch the video again, you'll see that he also goes to another site (same login) where he sets up the skill. You'll see there's an id (in the upper right of the Lambda page where you enter the javascript I think) that represents this Lambda app. You will copy and paste that over in the other site to link them. That's where you'll enter the intent schema and utterances that I provided.

The skill setup one I think is: developer.amazon.com, whereas the one where you entered the Lambda stuff is aws.amazon.com. It's kind of strange, but the Lamba stuff is used for lots of things besides Echo, so it's just the general ability to host code. The developer site is for apps and such, and the Echo is one of those.
on the Lambda side of things, don't forget to create an event source for your Skill

so you put the JS in Lambda, add an Alexa event source, then go to the Alexa portal (developer.amazon.com) and create the skill.

developer.amazon.com is sort of confusing, so once you log in, you need to go to Alexa, then across the top go to Apps & Services, then in the sub-menu bar select Alexa.

you'll need the Lambda ARN to create the skill.
I had not created an event on the Lamba side. When I did I was informed that what I had for my area (West) could not handle Alexa. I had seen that on the video but since other sites were available I thought they had expanded that. Anyway I changed the area to East and set an event for Alexa.

I then went to the skill I had created and changed the ARN to the one for the East.

Now when I ask Alex to have Control run Goodnite (my global action) she responds: "I am having trouble accessing your skill right now"

So now I think I need more work on the CQC side. This is what I have done:

Installed 7.4.5
Set up Web server with one of the available ports in the install
Did not check to use secure port because I do not have a cert right now
Created an EchoCFG.txt file and put it in CQCData/Server/Data/Echo
Restarted the CQC service
I have global events in /User folder

So Questions
Are we to paste the Javascript, Sample Utterances, and Intent Schema exactly as shown here (except in the java change the tar, port and id)?

Am I supposed to created a global event or macro from this:
System::LogMsg
P1=Home Theater GAct
P2=0
P3=Intent: %(LVar:CQCActParm_1), Key: %(LVar:CQCActParm_2), Parms: %(LVar:CQCActParm_3)
P4=Status

GlobalVars::SetVariable
P1=GVar:EchoReply
P2=The sprinklers have been started

Substituting my specific info?

Or do I wait for the CQC/Echo For Dummies that Deane suggested?
If it says it has trouble accessing your skill, then you aren't getting beyond the Amazon side of things. It sounds like your skill isn't quite set up right. Did you fill in all of the sections of the Skill configuration like the example in the blog? You need to provide the key word that will invoke this skill and that other stuff, which are up to you to select.

Quote:Are we to paste the Javascript, Sample Utterances, and Intent Schema exactly as shown here (except in the java change the tar, port and id)?

Yep, that's all you change.

The action you do whatever you want to do in response to the events that come in. For a start, just leave the logging in so that you can see if you are getting it set up correctly to invoke your action or not. If it works, then whatever response text you are setting should be spoken back to your (The sprinklers are running in the case of the sample I provided.)
IVB Wrote:Dean, i'm curious, what do you actually think of the Echo? Useful to execute commands via voice? Not really?

Obviously I personally like it, wondering what your opinion is.

Oops, this one slid paste me in the traffic... I'm probably not the best to ask since I've just been using it so far for development. I'm also in a small room with a pronounced sort of slapback echo. Even I have trouble hearing what I'm saying accurately in here and music sounds awful.

But so far, unless I'm mumbly or my southern heritage catches up to me (Yo, lexa, turn on yonder a/c, woman), it seems to do pretty well.
This is more detail on how to set up an Amazon Echo skill.

First you need to create an account at http://aws.amazon.com

There is a free tier service on the welcome page (Create a free account) but you still need to use a credit card. Once you're set up login to the AWS Management Console (use your Amazon credentials).

There are a lot of icons there but at the far left top under Compute is "Lambda". Clicking that icon gets you to the blue "Create a Lambda Function". Clicking that brings you to template choices. Select "Alexa-skills-kit-color-expert". Not much to do on this page but to select the "next" button, but notice the checklist approach on the left that gives you a progress of development for the skill. Select "next" and move on.

Now your in the "Configure Function" page. Here you name the skill (just any name will do, this is not the call name for the function), plus a description e.g. CQC Home Control" or whatever you wish.

Now go to Dean's post and copy the Java Script he provided. Paste that into the sample code box provided. The only changes needed are your IP address of your router (unless you have your own domain name) and port. You can locate your IP in your router setup or go to a web browser and search "what's my ip". You need to know what port you used for the CQC WebServer during install. Dean provided a key in the java script. You can use that or enter any text for a unique key. Use this key in your config file later on. Also ensure that port forwarding to the CQC Webserver local lan address (e.g. 192.168.x.xxx) and to the port is completed before testing.

Below the Java script area is a drop down tab for "Role". Select "Basic Execution Role". Selecting this brings up another confirmation page, but just select "Allow" on the lower right, which will bring you back to the Java Script area. Now your set for this page. Now select "Next". If something isn't right it will tell you. If not, you're good to go. Next page will be a summary of the function. Now select "Create Function".

Now you're on a page called "Lamba Function Test". Not much to do here but notice there is tab with Alexa under "Event Source" tab and a link to the "Amazon Developer" portal. Before you click this link go the ARN for this function on the right upper portion (opposite right of the blue test button). Copy the arn test (e.g. arn:aws:lambda:us-east-1:1234568912345689:function:test). Now hit the Amazon Developer link.

A new login page appears. Login with your Amazon credentials. Once on the landing page, select the yellow "Add a New Skill". This page allows you to set the name of the skill (any name will do), and the "Invocation Name" which is used to by the Echo and CQC. I chose "home" but control or CQC does work. Chose wisely, as some words won't work (you can change the name if one doesn't work via editing later). Supply a version number in the box. Below that is the "Endpoint". Click the ARN tab (not http) and paste in the arn:aws info from the AWS Lambda site.

Now you have a page with "Intent Schema" and "Sample Utterances". Go back and copy Dean's versions of these from his 2nd post http://www.charmedquark.com/vb_forum/sho...hp?t=12135

Now hit the yellow "next" button. Now you're Alexa skill ready for testing should appear. No need for certification unless you plan on monitizing this. Selecting "Next" you'll see a screen here but no need to proceed as this is for certification only.

Now if you go to your amazon echo under skills http://echo.amazon.com/#skills your skill should appear.

This completes all the stuff on the amazon side. Now you need to follow Dean's instructions for the config file. When I set this up I used only the config with a global action. That is easiest to set up for a test. Notice that Dean's example has a directory structure (/Echo) under the Global Actions directory. Name a function such as Sprinklers and try it out. Also note that to load the configuration file ask in my case "Alexa tell "home" to run load Echo configuration". Alexa will confirm the load. If you have made changes after the initial configuration load, reconfigure the driver or recycle the service to pick up the changes made. Otherwise it will use the previous configuration setup on discovery.

You'll know if things aren't working if Alexa just "color spins" versus telling you welcome to CQC Echo or something similar.

Hope this helps. By the way no expert here but a bumbling "dummy" that found his way....so this is a "Echo for Dummies".