Playing around with Amazon Echo (technical interface discussion)

Good news, I was able to get my Echo to see an emulated Hue bridge that has access to all my SmartThings devices! Luckily someone over on the Vera forums already had a similar idea and did all the heavy lifting, so I just did a few very minimal tweaks for it to work with SmartThings. This should work with Windows/Mac/or a Pi since it’s using Java.

Here’s the URL for the forum post:
http://forum.micasaverde.com/index.php/topic,31920.html

These are the steps I took to get it up and running on Windows 7:


Prerequisites

Setup a REST Endpoint Smartapp and select the devices you would like your Echo to be able to turn on/off (endpoint Smartapp from this tutorial)

  • Download and install Java 8

  • Download the JAR file (this is the Hue bridge emulator)

  • Make sure ports 8080, 1900, & 50000 are not in use on your machine. Run each of the following from CMD:

netstat -ano | find “8080”
netstat -ano | find “1900”
netstat -ano | find “50000”

All three of them should come back with no results. If it does come back with any PIDs kill the processes before continuing.

Run the Hue bridge emulator

From CMD, run the following (add the full path of the JAR and edit the IP)

java -jar -Djava.net.preferIPv4Stack=true C:\ENTER\THE]FULL\PATH\HERE\amazon-echo-bridge-0.1.1.jar --upnp.config.address=192.168.X.X

Add a new device to the Hue bridge emulator

  • Next you need to send an HTTP POST. You can either use the POSTMAN Chrome plugin or the I’m Only RESTing HTTP client (instructions are for the latter)

  • Open the I’m Only Resting app and set the method as POST

  • In the URL field enter in the following with your IP:

http://192.168.XX.XXX:8080/api/devices

  • Copy/paste the following text into the Headers box:

X-Application-Context: application:8080
Transfer-Encoding: chunked
Date: Sat, 09 May 2015 12:14:21 GMT
Server: Apache-Coyote/1.1
Content-Type: application/json; charset=UTF-8

  • Edit the name, onURL, & offURL below with the name you would like the Echo to discover the new device as, and the onURL & offURL from the REST Endpoint SmartApp:

{
“name” : “coffee maker”,
“deviceType” : “switch”,
“onUrl” : “http://graph.api.smartthings.com/api/smartapps/installations/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/switches/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/on?access_token=XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX”,
“offUrl” : “http://graph.api.smartthings.com/api/smartapps/installations/XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX/switches/XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX/off?access_token=XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXX
}

  • Copy/paste the edited text above into the Body section

  • This is what it should look like:

  • Hit Submit. You should see a response showing that the new device has been created.
  • LAST STEP! - Tell Alexa “Alexa, discover my devices” and you should now have the new device controllable by the Echo

Rinse & repeat the POST for any additional devices you want to be discoverable by the Echo.

13 Likes