Amazon Echo

@luma I was working on something similar for my Harmony Hub. I created 2 virtual switches, one for turning things on and one for turning things off. I put both of these in a group inside of the Alexa app. I then created 2 apps to immediately turn the switches off or on to reset their status. So the switches I use to turn stuff on will reset to off and vice versa. You can search for them in the dev apps with names “Keep Switches On” and “Keep Switches Off”. It sounds a little complicated but it gets the job done.

1 Like

I have been looking for a use case that would force me to figure out how to write a SmartApp, and I guess this was it. The solution I worked out above just seemed like way too many layers of kludge to accomplish a simple task.

I mostly copy and pasted from template code in the IDE to get this going. The result is a SmartApp that will link the state of a switch device with a lock device, such that:

  • Locking the lock will turn on the switch
  • Unlocking the lock will turn off the switch
  • Turning on the switch will lock the lock
  • Turning off the switch will unlock the lock

Create a new device with the “On/Off Button Tile” type, then install this app with the virtual button and a lock device. Now SmartApps that can control a switch device will be able to control a lock device.

5 Likes

I know this is for a physical switch syncing to a virtual switch but you are a coder and see if this will do any help.

@luma

This works great!! A bonus feature is (for users worried about someone yelling in an open window to unlock doors when they are away) you can set your app to only work in certain modes. So away mode won’t allow Alexa to unlock the doors. Great solution! Thanks for sharing!

1 Like

I have the new ST Hub V2, the Schlage Camelot Connect Z-Wave Touchscreen Deadbolt w/ Built-In Alarm, and the Amazon Echo. This is my first dive into home automation and have ZERO prior experience or knowledge. My vision was to bring these three things so together so that I can lock and unlock my front door via voice command to Alexa - so that’s when my GOOGLING began. My research brought me to this thread. I found Amazon Echo will not recognize a door lock device, but will recognize switch devices. I created this SmartApp and also the virtual device per the instructions in the source code comment block. Then I had to unlink and relink the my SmartThings hub in the Amazon Alexa App (Settings > Connected Home). When you link the Echo and ST it has you sign into your ST account. It will recognize any supported devices in this process. It recognized my virtual switch device which I had to authorize Echo to use by checking the box next to it. The next step was to have Alexa “Discover devices”. This can be done in the App or can be done by voice command. The final step was to bring it all together in the SmartThings app. There’s probably other ways to go about this, but this is what worked for me: Go to Marketplace > SmartApps > MyApps. You should see your “Link Switch and Lock” SmartApp. Select this SmartApp and configure it appropriately to lock the lock when your virtual switch is turned on, click Done. I first tested the SmartApp by going into my Things and turning my new Virtual switch on and off. Only about 1 second after toggling the switch on I heard my door lock and the status of the door lock in my Things was updated to LOCKED another second later. I tested the off/unlock as well and worked as expected. I was actually really surprised how fast it all was…guess I wasn’t expecting it to work this well :wink: Thanks for the great starting point and I hope my post helps others add the Amazon Echo component to the mix!

1 Like

Just wanted to add you don’t have to link/unlink in the Alexa app every time you add a device in order to get Echo to see it. In SmartThings App, you should have an Amazon Echo SmartApp after the initial link where your new device (physical or virtual switch) can be selected. At that point a discover devices either via app or voice should find it. See JD’s FAQ, while the app screenshots are a little out of date information is still good.

1 Like

I was very excited to hear about Amazon Echo integration with ST. I’ve been using Ubi for voice commands to ST and while it works, it’s pretty limited in terms of understanding… you need idea circumstances to really get Ubi to hear you correctly. Echo is supposed to be light years better in terms of what hear and understand. So I went out and got en Echo. I haven’t hooked it up yet… figured I’d way until I migrate to Hub 2.0 which is happening soon. But I’m wondering if I jumped too soon on getting Echo.

From what I’ve read, Ubi might have a leg up on Echo in a few areas… specifically customization.

Right now I can setup a rule (called a Lesson in Ubi) where I tell it what I’m going to say, and then what Ubi should do what I say that. For example: “Open the Garage Door.” This turns on a virtual switch in my ST setup which runs an app which checks if the door is open or not. If it isn’t, it opens the door.

Now, I can sorta get around this… I could name the virtual switch “Open The Garage Door” and just say: “Turn on Open the Garage Door” but that’s cumbersome and not very natural. IT would work, but it’d feel clunky.

However, the other side is even worse: I have a Smart App set that it triggered by a virtual switch. When I say Goodnight to Ubi, the app runs. It checks all the doors and windows on my main level and then the SmartApp sends a phrase for Ubi to say. For example: “You have left the den window, the kitchen window, and the back door open.”

I don’t think there is any real work round to get Echo to say this at all, is there?

I may have to stick with Ubi for a while if Echo can’t do those things. That’s a bummer cause I’d like really like to have the improved hardware of Echo, but not having custom phrases will suck.

This is true for now. There is a possibility that an API to send text-to-speech messages to Echo may become functional.

Also, there is a second Echo integration (@zpriddy ASK integration) that allows this:

“Alexa, tell the house to say Goodnight”, which may be a little more natural for some things.

1 Like

I never thought of that , Alexa can play " Simon says" and will repeat ( most anything) you say if you say " Alexa , Simon Says _________________________ " . Although I am not sure how somebody smarter than me could use that to have it give an response other than " Okay"

Quick question? Do you plan to have Alexa and Ubi in the same room or at least an Ubi for the room you are in and the Alexa remote.

Currently I request switches to trigger in Alexa, like running a Good night script and have the Ubi still respond to if required via the program or even Big Talk… The limit there is saying turn on Good NIght or Set Good Night On. I think I am running the Good Night Ubi script you wrote and also at several personally modified versions.of it.

Until Alexa can learn to process responses that we can program through SmartThings apps or though Alexa’s tools, my Ubis still has its uses, including verbal commands in quiet places.

Yeah, that was my Ah-ha moment a little bit ago. There’s no reason I can’t have Ubi and Alexa going at the same time. I did want to try to minimize and reduce a little bit, but it’s not the end of the world if I have to have both going until Echo gets custom phrase stuff going.

I’ll have to investigate if I can turn off Ubi’s pickup but still have Ubi speak. The goal of Echo is to have better voice recognition and do away with all the Ubi false positives when the TV is going.

Ohh… here’s a question… How good is Alexa if distriguishing “on” from “in”? For example, if I said Turn in kitchen light would it guess that I meant Turn on the Kitchen light? If so… then name the virtual switch that’s the trigger: “for the night.” Then your phrase becomes:

Alexa, turn in for the night. :slight_smile:

2 Likes

I would much prefer Alexa, turn on for the night! :slight_smile:

2 Likes

Alexa works fine with the TV unless her commercial is on. :smiley:

As for silencing the Ubi. The button/switch press is the key which is triggered by speaking the magic phrase. You should be able to just remove the switch that triggers the event, since Alexa would fill that role. And if you have more than one Ubi, just edit the one unit near Alexa. You could also delete the lesson, and restore it later when if needed, the Ubi could re-install it.

I wasn’t explaining clearly… I want to prevent Ubi from listening at all. I’ll use strictly Alexa for voice so I don’t want Ubi to be listening and clicking on false positives.

If did figure you wanted a more permanent solution, my suggestion was a work around until you do…

@chrisb
I have a momentary virtual switch set up for my garage door. When experimenting with alexa I would say " Alexa, open the kitchen lights" lights turn on, I then say “Alexa, close the kitchen lights’ again the lights turn on. I figured this is perfect for the momentary virtual switch. I say” Alexa, open the garage door" the door opens that part works great and sounds natural. However for some reason if I say "Alexa, close the garage door’ she adds it to my todo list :frowning:

A momentary burton turns itself on and then off immediately like a door bell as @JDRoberts and others have already explained. This may be your problem (my first thought. guru’s may chime in). Virtual switches processes on and offs!

Disclaimer: In no way am suggesting the use of Alexa or any other device to use garage doors. I use my regular native MyQ app and devices from Chamberlain.

yea, open and close aren’t dedicated key words for HA control, the fact that some of them work in interesting.
The only ones I’m aware of that always route to HA first are on/off and set.

The fact it turns itself on then off is exactly why I thought close would work. If I say close kitchen lights they turn on as well as saying open kitchen lights turn on. Was thinking if close or open turned lights on then close or open would toggle the garage switch and just seem more Natural. Right now I say open garage door and It opens, I then say open garage door again to close it. I’m thinking echo inturpets close garage door as a chore more then a command and just adds it to the todo list.

On/off always work, I think dim is a key word also but I can use brighten and set too. I’m not complaining was just pointing out that open/ close works for some devices. Maybe others have found other words that work as well?

Playing some more… Saying lock kitchen light turns them off unlock turns them on… Hmmmm