Playing around with Amazon Echo (technical interface discussion)

Got this up and running this afternoon. This is awesome and super easy. @Ron and @tgauchat thank you very much for your efforts here.

Only feedback, it would be great if the Java app allowed for Dynamic DNS address instead of an IP.

1 Like

[quote=ā€œschettj, post:180, topic:14887ā€]
Finally got settled in new house with server up, Echo up, and ST up. I used the code posted to gitub, put in my bearer and access uri, and the Echo detected the emulator and found my lights.
[/quote]And itā€™s still working a day later. Seems ok to me (ā€œit works on my computer, ship it!ā€)

1 Like

I got full dimming support working! All I was missing was an endpoint application that would support dimmer values from 0-100. Iā€™ve checked out a few options including ThingLayer and SmartTiles but couldnā€™t get the API I needed. I did however find an older version of SmartTiles back when it was called ActiON. Deploying that app gave me the API access I need. Iā€™m using the following device definition for amazon-echo-ha-bridge along with ActiON 3.0 and now I can dim my lamps with Echo:

{
"name" : "Kitchen Lights",
"deviceType" : "switch",
"onUrl" : "https://graph.api.smartthings.com/api/smartapps/installations/[Installation ID]/command/?access_token=[Access Token]&type=dimmer&id=[Device ID]&value=${intensity.percent}",
"offUrl" : "https://graph.api.smartthings.com/api/smartapps/installations/[Installation ID]/command/?access_token=[Access Token]&type=dimmer&id=[Device ID]&value=0"
}

Thank you @tgauchat and @DarcRanger and @jody.albritton and everyone else that threw me some suggestions!

4 Likes

So - I was able to get everything to work except for the dimming feature. When I try to use your URLs, I get a not found error.

{ā€œerrorā€:true,ā€œtypeā€:ā€œSmartAppExceptionā€,ā€œmessageā€:ā€œNot Foundā€}

Iā€™m assuming this means that my endpoints arenā€™t setup correctly, however I have them set as dimmers. Hereā€™s the URL that Iā€™m trying to run in my browser without my codes.

http://graph.api.smartthings.com/api/smartapps/installations/########-####-####-####-############/command/?access_token=########-####-####-####-############&type=dimmer&id=########-####-####-####-############&value=50

Thoughts?

Did you install the Action Dashboard version 3? The device definition I posted requires it.

Luma - Iā€™ll try that tomorrow. I didnā€™t realize the URLs were specific to that app.

All - JFYI - If you are having trouble getting the java app to work, make sure it is writing to the correct data directory. The java app defaults to the directory that you are in when you start the app instead of itā€™s home directory. I put this on a raspberry pi, and set it up to run on boot. Unfortunately, that put the data directory in /etc/init.d where my script was to run it. In my script, I had to actually change directory to the location I installed the java app, then run the file. This seemed to work. Itā€™s very possible that this is causing it not to work for you sporadically!

1 Like

I thought this was interestingā€¦the guy used the ā€œTo Doā€ command rather than putting the Echo into a particular app. Neither is ideal but some people may prefer one over the other. https://www.youtube.com/watch?v=amiQorlYTqg

Iā€™ve been playing around with this all day - great work for sure!

Just checking though - I assuming since we are emulating the HUE/Wemo bridge that actions such as ā€œLock/Unlockā€ or ā€œTurn down the thermostatā€ are not yet implemented. Just ā€œon/off/dimā€ commands?

That is correct. Only on, off, & dim commands work for now

Is anybody else experiencing a maximum of 10 devices that Echo will detect?

Im able to POST 11 endpoints to the emulator, and verified via http://ip_address:8080/api/devices, but Echo will only detect the initial 10 on the listā€¦

We can easily ā€œextendā€ the emulation spoofing by mapping a command such as ā€œturn on front lockā€ to mean lock the front door, ā€œturn off lockā€ (to unlock), etcā€¦

Similarly, ā€œturn on <Hello Home Phrase>ā€ are all really simple and workable concepts, as long as you use good Phrase names.

For heating, the dimmer level could be used: ā€œSet heater to 75%ā€ = *set the thermostat to 75 degrees".

Answered my own question - Looks like v0.1.1 only supports up to 10 devices, whereas v.0.1.2 supports more, with v0.1.3 supporting dimming.

Iā€™m not using the java emulation but rather my own node one, and the Echo finds 10 of 11 switches. So itā€™s apparently an Echo issue. The 11th switch (which is what I use as ā€œhueā€ bulbs) is not detected. Maybe an Echo thing

Wellā€¦ perhaps somebody with more than 10 ā€œrealā€ Hue Devices could place a support call to Amazon, please? Or check the developer forum. No rush for me at the moment, but itā€™s a silly restriction and worth confirming or logging as a bug.

There was a known Echo max in April with real Hues of 18 active devices and I think 25 total. Not sure if thatā€™s changed.

http://www.developers.meethue.com/content/amazon-echo-and-hue-bridge-discovery-problems

@smart has a bunch of real hues with Echo, maybe he knows.

Looks like the latest Echo now asks for

/api/OCJaG8Wv7DYcKj6TrLaUinXVo2kkL2KSqeD4jKoT/groups/0

to fetch the light list. Damn you Amazon :stuck_out_tongue:

Sorry ā€¦ I donā€™t understand the implications of this.

Does this mean that there is a limit to the number of discreet devices (even in a real Hue Bridge) or just a coding (API access path) change that the emulator can or can be modified to handle???

The Echo didnā€™t used to ask for group/0 - now it does. Group/0 just tells it the list of bulbs to expect - all your Hue bulbs are automatically in group 0. So if youā€™re not returning a valid response to that, it might not work. But I added a valid response (of 11 bulbs) and I still only am seeing Echo finding 10 bulbs (but it seems to be discovering 11) so maybe a limit somewhere in the Echo?

@JDRoberts Yes, I have 22 devices on Echo. If you scroll up this thread and search my post, it has screenshots.

1 Like

Looks like the Echo had an update and is being a bit more careful when working with Hue, calling more of the API to get lights.

After a bit of updating, I am now up to 11 bulbs, so 10 isnā€™t a hard limit - but you do need to emulate the full /groups/0 request and the base / request. Then Echo discovers all the lights.

My ugly hack node.js code will be updated in git shortly

2 Likes