SmartThings Community

Playing around with Amazon Echo (technical interface discussion)

(Matt) #283

I was able tonight to finally complete the steps that I started a couple weeks ago to control the thermostat temperature using my echo.

Here’s what I did

-1 Created a virtual dimmer switch, named it thermostat
-2 Created a SmartApp that copies the virtual dimmer level to my actual thermostat
-3 Using ThingLayer to control virtual dimmer thermostat via url

So now I can say “Alexa set thermostat to 72” and she does it.

(Kevin Tierney) #284

I keep the remote in the kitchen attached to the fridge (the echo is in the living room). It comes in handy if I’m playing music and want to skip songs or pause. I’m sure I could do it via voice command as well but it’s quick and easy with the remote

(Darc Ranger) #285


Are you willing to share your SmartApp code. That is the last piece of the puzzle for me. I already made SmartApps to control my Thermostat fan and modes.

Amazon Echo
(Matt) #286

It’s still very very rough, but it works. I used code from the big switch and dim with me.

My hope is that we’ll get actual integration soon. If not I’ll likely update this and make it better so that dimmer level also follows current setpoint and it gets the current mode head or cool and uses that info to set the heatpoint / coolpoint. You could also just create two smartapps and two virtual dimmers one called thermostat heat and one called thermostat cool.

name: "Set thermostat with dim level-Amazon Echo",
namespace: "matt",
author: "matt",
description: "Uses virtual dimmer level to set thermostat temp. Use with amazon echo",
category: "My Apps",
iconUrl: "",
iconX2Url: ""

preferences {
section("When this dimmer is set") { 
	input "masters", "capability.switchLevel", 
		multiple: false, 
		title: "Master Dimmer Switch...", 
		required: true

section("Tthis thermostat will follow") {
	input "slaves", "capability.thermostat", 
		multiple: true, 
		title: "Slave Thermostat", 
		required: true

def installed()
subscribe(masters, "switch.on", switchOnHandler)
subscribe(masters, "", switchOffHandler)
subscribe(masters, "switch.setLevel", switchSetLevelHandler)
subscribe(masters, "switch", switchSetLevelHandler)

def updated()
subscribe(masters, "switch.on", switchOnHandler)
subscribe(masters, "", switchOffHandler)
subscribe(masters, "switch.setLevel", switchSetLevelHandler)
subscribe(masters, "switch", switchSetLevelHandler) "subscribed to all of switches events"

def switchSetLevelHandler(evt)
if ((evt.value == "on") || (evt.value == "off" ))
def level = evt.value.toFloat()
level = level.toInteger() "switchSetLevelHandler Event: ${level}"
def switchOnHandler(evt) { "switchOnHandler Event: ${evt.value}"
def dimmerValue = masters.latestValue("level") //can be turned on by setting the level
(Matt) #287

Now we need a hack to trick Alexa into providing us information. Something similar to the wiki question ability.

But i want to say “Alexa what is the temperature in the bedroom” and she tell me. Or “Alexa what is the status of the back door?”

Obviously it’s also be neat for her to be able to tells us things without asking. Similar to the way her alarm is triggered only it trigger her saying “XXX is arriving”, “There is motion at the back door” Etc etc.

I have to give huge props to Amazon, this is probably my favorite techy toy, mostly because 9 times out of 10 she works exactly as she is designed/current ability.

(Cassidy) #288

I know someone else mentioned this on another post, but this can be done with bluetooth pairing a computer to the Echo, along with VLC Thing. Say you’re playing a Pandora station on the Echo with the computer paired via bluetooth, the natively integrated Pandora music will cut out temporarily while the bluetooth audio plays then will turn back on Pandora.

1 Like
Echo + Wink ! ! ! --- Echo + ST =?
(Darc Ranger) #289


Thanks for the Code.

I am curious, since I do not have this running yet. If you turn on a light via Alexa, can you specify the text of her response or does she just say “Light A is on”?

(Matt) #290

No when you tell Alexa to turn something on or off she just responds with OK once it’s done. If she “thinks” she found a match she asks you to confirm. If she doesn’t understand or find a match she doesn’t respond.

1 Like
(Matt) #291

Ya I’m familiar with that. I use vlc thing to play me other messages, it’s just not 100% affective. I use it via some airplay speakers.

(Matt Nieland) #292

FWIW: I had similar issues detecting the node.js emulator as UPnP. After restarting my PC, doing a netstat -ano | find “1900” and killing the task that was taking up 1900, then starting up the emulator, everything was right as rain.

I also needed to add firewall rules for 1900 TCP & UDP allowing connections and out. This might’ve been overkill but I was troubleshooting.

1 Like
( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #293

You could just do the “spoof” with a mapping in the Endpoint SmartApp, instead of a Virtual Device, no??

(Jay) #294

If you have an Internet line and can use any of the free DDNS, you can have your own cloud without paying for any hosting services. A static IP would be good too. If SmartThings start supporting WIFI communication in its next version, it would probably become Alexa Cloud to Your Router to Your Home Server to SmartThings.

Paying for hosting services is not a problem. The real problem is the lag time while your command have to travel through so many cloud servers before arriving at your light switches. Waiting 5 seconds for the lights to turn on after asking them to is not a cool thing after all.

Another possibility, when Alexa Voice Service is out, is to build a mobile app to capture your command then, through Alexa, translate it into API calls to the SmartThings Custom SmartApps API. For this we don’t even need to buy an Echo device nor to release any Echo Apps. Correct me if my assumption is wrong somewhere. Apparently SmartThings can also adapt this idea into their existing app like how Wink and Scout Alarm are doing.

(Rob W.) #295

Wow, what a bunch of smart people we have on this forum! Smarter than me for sure. I am loving my home automation and my new Echo. I’ve been successful setting up several things with code from other ST’s forum threads. Would anyone be willing to create a step-by-step Echo for Dummies - I would like to control all of SmartThings lights, garage door, and Nest using Echo. I see so many bits of awesome info, but I always get hung up somewhere in the details. Thanks!

1 Like
(Ron) #296

I attempted to document my version of the server. Checkout the readme on my raspberry branch here

This is to setup the version of the bridge I modified. It talks directly to the smart app so you don’t have to do “Post” calls anymore. It also updates correctly when devices are added or removed.

My instructions are raspberry specific but should work on most unix systems. On windows you have to do a little work on your own.

Also one suggestion I would not put Garage on my echo because some outside could shout “Alexa open garage” and it would open :slight_smile: Of course you could name the garage something secret and then this would help secure it…Hmmmmm name it sesame …“Alexa Open Sesame” LOL


I’d like to set up a hue bridge emulator but wonder if it will play nicely with a real hue bridge also running. I’ve been unable to find anything specifically addressing this.

( co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #298

Yes … in my experience so far, there has been no confirmed interference between my Hue Bridge Emulator and my real Hue Bridge.

The disclaimer is that I have always had some inconsistent behavior related to Hue – i.e., I am not a scientifically controlled test environment.

1 Like
(Rob W.) #299

Thanks Ron! I may try to use the Raspberry setup, as I have been wanting one, and I think keep it running as the server instead of a PC makes the most sense. Any tips on buying a Rasp Pi and specific kit pieces?

(Ron) #300

I just bought

  • Raspberry Pi 2 Model B (1GB ram 900Mhz Quad Core CPU)
  • plastic case
  • 32GB Micro SDHC memory card (more than needed but only $15 so why not)

You also need

  • usb charger
  • micro usb cable
  • network cable

If you want wireless you need the wireless card but I didn’t do that so not sure what to recommend.


Are you on windows ?? "did you start the command prompt by using the “run as administrator” option ?? Using this method my problem was resolved, hope this helps !!

(Marc) #302

I had this working last night and then it stopped working. I admit, I am new coding/RestAPI/Oauth. I am able to successfully post the device commands via PostMan and I know my Oauth tokens and url’s are working properly (I tested in a browser). However, when I go to do a discovery via Echo, it doesn’t find any of the devices I was posted. I deleted the data directory and tried to start fresh, but it doesn’t fix it. I am running the .jar file on my Mac and it’s listening properly.

Any ideas?