Announcing Native Amazon Echo integration

I’m getting the error message “unexpected token E”… I used the generate sha1 password and used that in the password field. My plain text username in the username field.

I have the updated lambda file –
hostname: ‘vera-us-oem-autha.mios.com’,

Any ideas on how to troubleshoot this?

2016-01-19T22:25:43.547Z 9370a5d6-befb-11e5-b38f-752ca0eea547 discovery for accessToken enterAccessToken
2016-01-19T22:25:44.014Z 9370a5d6-befb-11e5-b38f-752ca0eea547 SyntaxError: Unexpected token E
at Object.parse (native)
at IncomingMessage. (/var/task/index.js:381:27)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)

That error message should come from line 380, but your stack trace says line 381. Make sure you haven’t accidentally changed anything else. You shouldn’t have to change the server name either - the updated version on github has the right server.

The error message is that your credentials are wrong. When you typed them in to the web page, you perhaps didn’t enter your username. You need to enter both username and password to get your access string. I’ve updated the web page on github to make that obvious. If you did enter both, perhaps you entered the values incorrectly?

Martin

The line number is off due to the new version of code has 587 lines and the older one 588. The line that is missing is

var authd11Server = “vera-us-oem-authd11.mios.com”;

was that intentional?

Yes, that line was removed because it’s not required.

Martin

I re-read the thread and realized i missed out that this is for UI6. I’m on UI5. I’m going to look into upgrading… thanks for your help.

If you have some coding skills, UI5 is actually much much easier to integrate. You don’t need all of the code to do the session tokens. Just make a call to https://sta1.mios.com/locator_json.php?username={username} in getAuthToken to get the relay server in JSON format, and then call to https://{relay server}/{username}/{password}/{serial}/data_request?id= for the discovery and device control requests. About half the code can come out because of the simpler UI5 security.

Martin

[quote=“martin12345, post:1, topic:189448”]I have written a native Amazon Echo integration for the Vera - i.e. it gets added as a Device Link, and the devices can be controlled just by saying “Alexa, turn Living Room on” and so on. It doesn’t require you to be running any local server like the bridge solution - it all runs from the Amazon cloud.
Martin[/quote]

If this is running in the cloud, then you won’t be able to run any voice command if your internet is down. Having a Vera to Alexa bridge on a PC or Raspberry PI should allow you to run a command locally even if the internet is down.

While I like the idea of having this running within Alexa (AWS based) I am reluctant so I stopped my testing and integration following your instructions.

Thoughts?

[quote=“Pseudomizer, post:47, topic:189448”][quote=“martin12345, post:1, topic:189448”]I have written a native Amazon Echo integration for the Vera - i.e. it gets added as a Device Link, and the devices can be controlled just by saying “Alexa, turn Living Room on” and so on. It doesn’t require you to be running any local server like the bridge solution - it all runs from the Amazon cloud.
Martin[/quote]

If this is running in the cloud, then you won’t be able to run any voice command if your internet is down. Having a Vera to Alexa bridge on a PC or Raspberry PI should allow you to run a command locally even if the internet is down.

While I like the idea of having this running within Alexa (AWS based) I am reluctant so I stopped my testing and integration following your instructions.

Thoughts?[/quote]

No, that’s not correct. If your internet is down, your Echo can’t understand what you say in the first place. It needs an internet connection to turn your speech in to text that can be acted on. So neither the bridge solution nor the full solution will work if your internet is down.

The bridge solution depends on your Echo, Amazon’s service, a local computer and your vera all being working. The native solution takes one step out of that, and just needs your Echo, Amazon’s service, and your vera all being working. So it’s inherently more reliable.

Martin

[quote=“Pseudomizer, post:47, topic:189448”][quote=“martin12345, post:1, topic:189448”]I have written a native Amazon Echo integration for the Vera - i.e. it gets added as a Device Link, and the devices can be controlled just by saying “Alexa, turn Living Room on” and so on. It doesn’t require you to be running any local server like the bridge solution - it all runs from the Amazon cloud.
Martin[/quote]

If this is running in the cloud, then you won’t be able to run any voice command if your internet is down. Having a Vera to Alexa bridge on a PC or Raspberry PI should allow you to run a command locally even if the internet is down.

While I like the idea of having this running within Alexa (AWS based) I am reluctant so I stopped my testing and integration following your instructions.

Thoughts?[/quote]

As the last poster said, your forgetting the fact that ECHO doesn’t have any logic built in it. ECHO is a speaker, mic and wifi modual in a box and all internet based for it’s logic. You speak and the mic sends you voice to the internet for translation then it comes back to the speaker from the web. Without the internet ECHO alone can do nothing let alone the rest of the bridge to vera stuff.

Thanks guys.

Trying to get this working with my Vera, does this work with UI7?

Also, if this does work with UI7. What do I put in these fields when I email Amazon?
OAuth Scope:
OAuth Authorization URL:
OAuth token URL:

i’m using Login with Amazon

Yes, it works with UI7. The values you need are as follows;

The OAuth Scope: profile:user_id
The OAuth Authorization URL: https://www.amazon.com/ap/oa
The OAuth token URL: https://api.amazon.com/auth/o2/token

Martin

Martin,

About how long should it take to setup, for someone who knows no more than your documentation outlines?

Thanks!

The steps it takes (create free AWS account, create OAuth service, create Lambda function, send e-mail to Amazon) should take about half an hour, but if anyone else has feedback on how long it took them, I’d love to hear, as well as any suggestions for making it faster. Once you have finished those steps, you need to wait a day for the Amazon folks to flick the switch on their end. It can be a lot faster (took 15 mins the first time I e-mailed them), but don’t hold your breath waiting for an instant e-mail response from them.

Hello again… I upgraded to UI7 so I’m back…

What is the

OAuth Client ID
OAuth Client Secret

and for the OAuth Scope: profile:user_id
Are you suppose to substitute a user_id or is it literally user_id? If substitute, which user_id?

many thanks!

The ClientID and Client Secret are given by the Login With Amazon system when you enable that.

the scope is literally “profile:user_id”. No need to substitute anything in there.

Martin,

I am stuck early on. Please see PDF. Did I guess the correct settings so far? When, how, do I email Amazon, and where do I locate the items you reference on page 2 of your instructions, to send to Amazon?

Thanks!

I’ve created a walkthrough here that should answer all of your questions;

Martin

I received confirmation from Amazon but when I open the Alexa app and click on link with Vera, I get an error saying “an error occurred while attempting to link Alexa with the external provider. Please try again later.”

The test worked on lambda. I will try to go through all the steps again to make sure I have everything right.