Amazon Echo Skill EchoToEventGhost

If you have a question or need help, this is the place to be.
Post Reply
r1kkie
Posts: 16
Joined: Wed Aug 26, 2015 7:19 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by r1kkie » Thu Dec 01, 2016 10:13 pm

I am i great need of assistant... :/
I just got my hands on a Echo Dot and want to integrate it with EG but having problem understanding the guide. This is basically:

1. Add new skill on the developers amazon console.
Image

2. I fill in the first form ”Skill Information”
a. The name box is just to show what the skill is called in the Alexa app right?
b. Invocation Name is what the unique word is for alexa to trigger the Echo to eventghost skill?
c. Hit Next to generate the ID in my example: amzn1.ask.skill.8349c155-f14e-44cb-9c6b-6c16c9435073
Image

3. Naviget to the AWM Lambda whatever its calla den hit get started choose “Node.js 4.3”, (assuming it is what to choose cause the file submitted in the first post is called .js) and pick a blueprint, doesn’t matter witch one at this point, right?

4. Adding trigger “Alexa Skills Kit

5. So now it is time to creat the Lambda function.
a. Does it matter what you named to?
b. Copy the text from index.js and post in the the code window. Changing the EG_ip to my webserver address. Also adding the port number.
c. The Echo_ID is the string generated from 2c?
Image

6. What do I choose in the Lambda function handler and role?
Image

I am inputting these values.
Image

7. So the review looks like this the hit “Create function”
Image

8. Does this look right? ARN number is noted in the top right corner: ARN - arn:aws:lambda:us-east-1:793476991232:function:Eventghost
Image

9. Head to the dev. Amazon page and continue where we left of in 2c and hit next to get to “Interation Model” and copy past the Intent Schema and Sample Utterances provided in the first post and hit next.

10. Inte configuration window there is a box where u first pick location and then enter a value or string in a box, what do you put in there? Is it the ARN number from the AWN function (arn:aws:lambda:us-east-1:793476991232:function:Eventghost)?
To keep on going I typed the ARN string and hit next.
Image

11. That brings me to the Test window, Im I done here? Do I have to do anything else?
Image

12. Now I can see the skill in the alexa webpage under skills
Image

13. In this window where you create your skill there is a test box. Is it supposed to work there, I’m getting some kind of error message, might have typed in wrong utterance.
Image

Im starting with this to see if anyone can check if I did right here or if something is wrong. Iam completly new to these kind of things and appriciate all the help I can get.

kkl
Experienced User
Posts: 306
Joined: Wed May 04, 2011 9:32 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by kkl » Fri Dec 02, 2016 5:42 pm

r1kkie,

Two things:
1. You must use your WAN IP and it must be routable, not 192.168.1.120.
2. In your router, make sure to forward the port to your EG webserver.

r1kkie
Posts: 16
Joined: Wed Aug 26, 2015 7:19 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by r1kkie » Sat Dec 03, 2016 3:02 pm

kkl wrote:r1kkie,

Two things:
1. You must use your WAN IP and it must be routable, not 192.168.1.120.
2. In your router, make sure to forward the port to your EG webserver.
First of all thanks!
Just changed the IP to the WAN as you said and I am now getting the HTTP string in EG log window.

My next question is how do I link the string (HTTP.EchoToEG [u'test']) that is logged in EG to an macro? I cant just drag and drop beacause the whole string is not attached. Just the HTTP.EchoToEG and the "[u´test] disappears.

Edit:
After some reading I learned that its called Payload and you need somekind of pythonscript to get it. Never used pyhtonscript before and I tried to insert the pyhtonscript that TS provided but i get error messages. Do i have to rewrite it?
Does the pyhtonscript get the payload and then post the payload in the log as an http string? That would be the best cause then I can just drag and drop the string to the desired macro. :)
Attachments
EG.PNG

kkl
Experienced User
Posts: 306
Joined: Wed May 04, 2011 9:32 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by kkl » Sat Dec 03, 2016 9:45 pm

Yes, it does involve extracting the payload, but you can do it with just a couple of Python commands. Something like this:
Capture.JPG
Capture.JPG (14.11 KiB) Viewed 1825 times
The point is to generate your own Event that you can then use to activate the desired macro. Each line:
1. The Event generated from Alexa (payload not visible).
2. Create a name for your own trigger using your own name plus the payload from the initiating event. This is done with a python command: MyTrigger = "MyTrigger." + eg.event.payload
3. Finally, use the new variable you just created in step 2 to generate a new event, again with a python command: eg.TriggerEvent(MyTrigger)

If you're initial payload was 'nice', this example will generate the event Main.MyTrigger.nice which can then be used to trigger the desired macro.

I added one step to make it easier to follow. You can actually create the new trigger with a single command: eg.TriggerEvent("MyTrigger." + eg.event.payload)

r1kkie
Posts: 16
Joined: Wed Aug 26, 2015 7:19 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by r1kkie » Sat Dec 03, 2016 11:07 pm

kkl wrote:Yes, it does involve extracting the payload, but you can do it with just a couple of Python commands. Something like this:
The attachment Capture.JPG is no longer available
The point is to generate your own Event that you can then use to activate the desired macro. Each line:
1. The Event generated from Alexa (payload not visible).
2. Create a name for your own trigger using your own name plus the payload from the initiating event. This is done with a python command: MyTrigger = "MyTrigger." + eg.event.payload
3. Finally, use the new variable you just created in step 2 to generate a new event, again with a python command: eg.TriggerEvent(MyTrigger)

If you're initial payload was 'nice', this example will generate the event Main.MyTrigger.nice which can then be used to trigger the desired macro.

I added one step to make it easier to follow. You can actually create the new trigger with a single command: eg.TriggerEvent("MyTrigger." + eg.event.payload)
I must be slow or something cause I dont understand a shit. What name shall I create and where do I put it for starter? :( I appreciate the help.

Whats wrong here? :/
Attachments
Capture.PNG

kkl
Experienced User
Posts: 306
Joined: Wed May 04, 2011 9:32 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by kkl » Sun Dec 04, 2016 12:13 am

r1kkie wrote:
kkl wrote:Yes, it does involve extracting the payload, but you can do it with just a couple of Python commands. Something like this:
Capture.JPG
The point is to generate your own Event that you can then use to activate the desired macro. Each line:
1. The Event generated from Alexa (payload not visible).
2. Create a name for your own trigger using your own name plus the payload from the initiating event. This is done with a python command: MyTrigger = "MyTrigger." + eg.event.payload
3. Finally, use the new variable you just created in step 2 to generate a new event, again with a python command: eg.TriggerEvent(MyTrigger)

If you're initial payload was 'nice', this example will generate the event Main.MyTrigger.nice which can then be used to trigger the desired macro.

I added one step to make it easier to follow. You can actually create the new trigger with a single command: eg.TriggerEvent("MyTrigger." + eg.event.payload)
I must be slow or something cause I dont understand a shit. What name shall I create and where do I put it for starter? :( I appreciate the help.

Whats wrong here? :/
You can call it whatever you want and put it wherever you want. It just needs to make sense to you. You might need to spend some time just learning the basics of how EG works.

In your screenshot, I see the error "cannot concatenate 'str' and 'list' objects". In your original example, I thought you were getting from Alexa the string 'nice', but it appears that you are actually getting a list of one item. Lists and Strings are different variable types in Python. To use the first variable in a list, you would just change eg.event.payload to eg.event.payload[0].

r1kkie
Posts: 16
Joined: Wed Aug 26, 2015 7:19 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by r1kkie » Sun Dec 04, 2016 10:22 am

kkl wrote:
r1kkie wrote:
kkl wrote:Yes, it does involve extracting the payload, but you can do it with just a couple of Python commands. Something like this:
Capture.JPG
The point is to generate your own Event that you can then use to activate the desired macro. Each line:
1. The Event generated from Alexa (payload not visible).
2. Create a name for your own trigger using your own name plus the payload from the initiating event. This is done with a python command: MyTrigger = "MyTrigger." + eg.event.payload
3. Finally, use the new variable you just created in step 2 to generate a new event, again with a python command: eg.TriggerEvent(MyTrigger)

If you're initial payload was 'nice', this example will generate the event Main.MyTrigger.nice which can then be used to trigger the desired macro.

I added one step to make it easier to follow. You can actually create the new trigger with a single command: eg.TriggerEvent("MyTrigger." + eg.event.payload)
I must be slow or something cause I dont understand a shit. What name shall I create and where do I put it for starter? :( I appreciate the help.

Whats wrong here? :/
You can call it whatever you want and put it wherever you want. It just needs to make sense to you. You might need to spend some time just learning the basics of how EG works.

In your screenshot, I see the error "cannot concatenate 'str' and 'list' objects". In your original example, I thought you were getting from Alexa the string 'nice', but it appears that you are actually getting a list of one item. Lists and Strings are different variable types in Python. To use the first variable in a list, you would just change eg.event.payload to eg.event.payload[0].
Okok, not sure I totally understand but read through the thread and found the python command I was looking for: eg.TriggerEvent(eg.event.payload[0][0:55],prefix=eg.event.suffix)
Now everything works lika a charm. Thanks for your help, much appreciated!

theblur
Posts: 4
Joined: Thu Aug 21, 2014 11:03 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by theblur » Sun Dec 04, 2016 7:15 pm

Firstly! huge thanks to m19brandon for putting this together!

Im just about to have a look at this as I have quite a large but straight forward eventghost setup throughout the house using Lightwaverf via RFXTRXCom, PCs IRblasters etc.

Just question m19brandon or someone maybe able to answer.
Can the EG_ip be for example a google chrome URL? I use AutoRemote which allows access through my Router as I dont have a fixed IP or is the placeholder numeric?

I'll give it a go in the meantime over the coming evenings and see how I get on with the setup.

i'll report back findings but if not currently possible would be great if the AutoRemote Google Chrome URL could be processed (I take it this is a return path from the amazon speech server?)
Sorry first time in and finding my bearings, does anyone know if this already works instead of signing up with a DynDNS service?

Cheers,
nick

theblur
Posts: 4
Joined: Thu Aug 21, 2014 11:03 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by theblur » Mon Dec 05, 2016 2:53 pm

Odd I had written a post about the tests I carried out but it didnt appear.

Just curious if anyone know whats missing.

I can perform the Lambda test via create test and using Alexa start session its successfull (bearing In mind I commented out the same code R1kkie did relating to the application check not equal as I too was getting an invalid application it but it seems correct.)

I can perform the Skill Text test and I get in eventghost the HTTP Test text I put in.

'homeserver' is my invocation name i have tried others.
and for the utterance and scheme I put in exactly as m19brandon had supplied with no changes.

However when I ask:
Alexa, ask homeserver one two three

I get nothing but alexa saying she either couldnt find a game to open or something similar.

Any ideas why Im not seeing text passed to eventghost only via the SKill text test?
Ports obviously opened as per above test seems to show..

pretty stuck if anyone has ideas I try anything, played around last night for a while and was total stumped.

Thanks,
Nick

theblur
Posts: 4
Joined: Thu Aug 21, 2014 11:03 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by theblur » Mon Dec 05, 2016 8:36 pm

Guys not sure why some of my posts are not making it however in the spirit of the community I'll try another.

For anyone whos Lambda passes the create Test Scenario -> Alexa Start Session and the skill passes the text test and you see it in Eventghost but when you speak the command nothing reaches Eventghost then:

You quite likely need to add English (UK) as a language in your skill (with the same sample utterances etc as per this evenghost tutorial.
I did this as my device is in Europe i.e. my Lambda location is showing as EU-West in the ARN string.

Hope this helps.

m19brandon
Experienced User
Posts: 177
Joined: Mon Feb 03, 2014 10:36 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by m19brandon » Tue Dec 06, 2016 4:41 am

I will try to up the guide, aws looks a lot different then 8 months ago with a lot more option.

You could use Autoremote's tiny url he provides but you would need to edit the format of the post in JavaScript on your skill to match his format.

jonib
Plugin Developer
Posts: 1245
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Amazon Echo Skill EchoToEventGhost

Post by jonib » Tue Dec 06, 2016 8:28 am

theblur wrote:Guys not sure why some of my posts are not making it
The first posts of a new user will need to be approved by a moderator, mostly within a day or so. Why? To not let spambots run rampant and sully the forum.

And you are considered a "New" user until you have a couple of approved posts.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

theblur
Posts: 4
Joined: Thu Aug 21, 2014 11:03 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by theblur » Tue Dec 06, 2016 8:51 am

Thanks Jonib.

Also thanks again to m19brandon and r1kkie for posting up step by step detail it helped hugely!

I got everything working to EG last night and mapped my outputs to my already existing macros!
Albeit its exact text at the moment I just need to go through in detail more the inbound voice text processing.

Cheers guys if I spot more bits that I got stuck on like the language thang I'll post back, it might be useful to some.

Nick out.

therealbiglou
Experienced User
Posts: 105
Joined: Sat May 19, 2012 4:33 am

Re: Amazon Echo Skill EchoToEventGhost

Post by therealbiglou » Wed Dec 07, 2016 9:20 pm

r1kkie, seriously, thank you. Without your step by step directions, I would not have gotten this working.

By the way, I use Eventghost to control my AV receiver and TV. I also happen to have an Xbox One with Kinect and voice commands. So, to use both, I can now say "Alexa, tell my TV to Xbox On". The created event switches my receiver input and turns on my TV while the act of me saying "Xbox On" also wakes up my Xbox. Pretty cool!

Statikk
Posts: 1
Joined: Tue Dec 13, 2016 9:55 pm

Re: Amazon Echo Skill EchoToEventGhost

Post by Statikk » Tue Dec 13, 2016 10:30 pm

OK so I have things working but I have a few questions I'm hoping someone can help me with.

1. When I give a valid command Alexa responds with "Got it. Working on the command <commandname>." Is there a way to disable this for certain commands so there is no response or have her reply with a phrase of my choosing?

2. When I give an invalid command Alexa responds with "Got it. Working on the command <commandname>." Is there a way to have her reply that the command is unknown or something along those lines?

I have attached a screenshot of my EG config. The Webserver: Set temporary value stuff was me attempting to figure this out.

Thanks m19brandon for the code and everyone else for your examples.
Attachments
eghost.PNG

Post Reply