How To Make Any Alexa Enabled Device Work With SmartThings

Many smart home products are compatible with Alexa, but far fewer are directly compatible with Samsung SmartThings hub. The SmartThings’ automations are more powerful so wouldn’t it be great if we could link these two universes together?

This tutorial will teach you a method to make any device that can be controlled by Alexa also be controllable by Samsung SmartThings.

Recently, Alexa added an option that allows certain types of sensors to trigger Alexa routines (this only works for people in the US and UK…don’t ask me why that is).

The method in this tutorial takes advantage of that option. It let’s you trigger an Alexa routine with basically any SmartThings action instead of just the sensor trigger. It may seem like it’s a bit of a hack (because it is), but it works well. And, in my experience it’s quite reliable.

Here’s the method in a nutshell:

  1. Create a virtual switch/sensor in SmartThings
  2. Create an Alexa routine that is triggered by the virtual sensor. The Alexa routine will send a command to the device you’re trying to control.
  3. Create two SmartThings automations that turn the virtual switch we just created on or off.

The SmartThings automation triggers the virtual sensor, which in turn triggers the Alexa routine which sends the command to the device. Simple, right?

You will need:

If you follow this tutorial, you should be able to have your first routine up and running in about 20 minutes. After that, creating more only requires a couple minutes each.

1. Create the Virtual Switch/Sensor

Go to the following page:

Select all text (ctrl-a) and copy (ctrl-c). Then paste (ctrl-v) to your New Device Handler

Go to https://developers.smartthings.com/. Click on Login in the upper right hand corner.

Then, sign into your Samsung account. If you already have your SmartThings set up, you should already have a Samsung account. If not, you’ll need one.

If this is your first time, you’ll have to agree to some terms and conditions by checking a box. Then, click Next.

Eventually, you should end up on a screen that looks like the screenshot below. Click on My Device Handlers.

This will take you to your list of device handlers. We want to Add one now.

Next, you should see the Create New Device Handler screen. We are going to use some code someone has already written so we want to create From Code.

The code we are using will create a device that will be a virtual switch and contact sensor in one. When you turn the virtual switch on or off, the virtual contact sensor gets automatically turned on or off by the switch.

Luckily, there’s all kinds of generous people in the SmartThings community that create custom code and share it with us for free.

To get the code, go to the following page: https://raw.githubusercontent.com/bjpierron/SmartThings-Alexa/master/devicetypes/bjpierron/simulated-alexa-switch.src/simulated-alexa-switch.groovy

Select all text (ctrl-a) and copy (ctrl-c). Then paste (ctrl-v) to your Create New Device Handler page.

Scroll to the bottom of the Create New Device Handler page and click Create.

This will create a SmartDevice named “Simulated Alexa Switch”. You should see the green “Created SmartDevice” message. Before you can use it, you’ll have to publish it, so click Publish.

If everything goes as expected, you should see the green “Device type published successfully” message.

Next, we need to create the device that will use the device handler we just added. Click on My Devices in the top menu bar. Then, click New Device in the upper right corner.

Then, you’ll have to fill in the required blanks. I named my device “virtual switch” but you can name yours whatever you want.

When you select “Type”, you want to select “Simulated Alexa Switch”. It will be all the way at the end of the pulldown list. This tells SmartThings to use the code we just published for this device.

Once the appropriate blanks are filled in, click the blue Create button to create your device.

Now, check to make sure it worked. If you click on My Devices, you should see a list of your devices which should include your new device.

Great, the device is created. That’s all you need to do here.

2. Create The Alexa Routine

Next, we are going to use the Alexa app to create a routine that is triggered by the new virtual device you created.

First, Enable SmartThings Skill

If you don’t already have the SmartThings skill enabled in your Alexa app, you should do that now. This will allow your Alexa app to see the virtual device you just created.

To enable the SmartThings skill:

  1. Open your Alexa app and select devices from the bottom menu.
  2. Then, select “YOUR SMART HOME SKILLS”.
  3. Press “ENABLE SMART HOME SKILLS”.
  4. Next, search for and select the SmartThings skill.
  5. Finally, press “ENABLE TO USE”.

Create New Routine

For this routine, you will use the virtual switch closing as your trigger and any action you want for the action. Here’s how I did mine:

  • Go to the main menu in the Alexa app and select Routines.
  • Press + to create a new routine.
  • Press + next to When this happens.
  • Select Device.
  • You should see the name of the device you just created. Mine is virtual switch. Select it.
  • You can choose to activate the routine when the switch either closes or opens. I am going to choose Close. Then press SAVE.
  • Now select Add action.
  • Select Smart Home.
  • Select Control device.
  • Select the device you want to control. I have an Amazon plug that controls some LED strip lights in my living room. It’s called Up lights.
  • I’m going to use this routine to turn those lights on. Press Next.
  • Press Save.

That’s all you need for now with the Alexa app.

3. Create SmartThings Automations

We are going to create two automations in the SmartThings app to make this work properly.

The first automation will be the automation you use to trigger the Alexa routine you just made.

It will close the virtual sensor (which triggers the Alexa routine) when my living room motion sensor senses motion. You can choose anything you want in place of my living room motion sensor, but the rest should stay the same.

The second automation will reset the virtual sensor. Without this second automation, the first automation will only work once. The virtual sensor would basically be stuck closed and it would never trigger the Alexa routine again.

First SmartThings Automation

Our virtual switch/sensor that we created works like this: when the switch is turned on, the sensor is open. when the switch is turned off, the sensor is closed.

Now, remember that we set our Alexa routine to trigger when the virtual sensor “closes”. That means our SmartThings automation should turn the switch off (which closes the virtual sensor) to activate the Alexa routine.

Don’t think too hard about it. Just follow these steps and it will work.

To create the first SmartThings automation, open the SmartThings app,

  • Select Automations from the main menu.
  • Then, Add automation.
  • Then select Custom automation.
  • This brings you to the custom automation screen. Select + under the If section.
  • Choose Based on a device status.
  • Scroll down to find the device you want to trigger this action. For me its my living room motion sensor which is just named Living Room.
  • Then, I select the trigger conditions for my device, which are detect motion and detected. Yours may be different depending on the type of device you choose. When you’re done, press Next.
  • Now let’s add the “Then” part of the automation. Press +.
  • Select Control a device.
  • Find and select the virtual switch in your list of devices. Press Next.
  • Select the virtual switch which should now be displayed under the Then label to change the options.
  • Select off so that the virtual switch turns off when motion is detected. Push Next.
  • Click Save. Automation 1 is done.

Second SmartThings Automation

This automation will reset the virtual sensor back to the open position so it’s ready to be triggered again by the first automation.

  • Press + to start a new automation.
  • Select Custom automation, which bring us to a clean custom automation screen.
  • First add the If condition.
  • Again we want Based on device status.
  • This time we choose virtual switch.
  • Select the Contact sensor, closed condition. Then press Next.
  • Now add the “Then” action. Press + under the Then label.
  • Select Control a device.
  • This time select the virtual switch again and press Next.
  • Select the virtual switch to adjust the settings.
  • Make sure the action is set to On. Then turn on the option to “Select how soon to start the action after the conditions are met”.
  • Choose 10 Seconds. Press Done.
  • Then, press Save and the second automation is done.

Final Thoughts

Now all that’s left is to test it out.

I know that was a lot of steps, but I try to be really thorough in case anyone who is completely new to this is reading. I promise once you do it a couple times, it only takes a couple minutes.

You should be able to repeat this process as many times as you want for any device that can be controlled by Alexa.

Anyway, I hope this was helpful and thanks for reading! If you have any questions, feel free to drop a comment below.

Eric Blank

Eric Blank blogs about smart homes and other connected technology here at thesmartcave.com. He enjoys technology, sports, outdoors, and dabbles in the dark realm of politics. He dreams of someday living in a castle on an island but for now will settle for smalltown, USA.

Click Here to Leave a Comment Below
Gregg H - a few months ago Reply

Nice guide but how do I turn off a device with this process? Do I need a separate virtual switch dedicated for turning it off?

Faron - a couple of months ago Reply

Great guide. Is this still only available in the US and UK? I’m in Canada and the virtual device is not showing up in Alexa. Also can we just use the Create Virtual Device feature on the ST Classic app?

David M - last month Reply

Nice instructions. Worked first time. The step I was missing was the Device Handler and that did the trick. Thanks for allow most of my devices to now work through Smartthings.

Justin - last month Reply

For some reason, it will not allow me to create the routine. It just gives me the error “There was a problem creating this routine”. Could Amazon shutdown this work around?

Grant - last month Reply

Hi. Have been following this guide for months had no trouble with any of the steps but now it’s not allowing me to create the right automation in smartthings…the Alexa routine works when I play it in the Alexa app but when I create an automation in smartthings I select control a device, select my newly created virtual switch and choose when set to on, go next, and then the device wont appear in the list.
To be sure I wasnt doing anything wrong i referred to this guide again and i am following the correct steps.
So I went back into my automation that I created beforehand that do still work and it wont let me edit them, the ‘if’ automation works, but the ‘then’ automation doesn’t recognise it as a simulated Alexa switch so I cannot assign it. Is there an update to the DTH? I’ve checked my IDE account and all the devices and the DTH are still there so just wondering why this is no longer working? Is there a known issue or a workaround? Many thanks in advance.

Bud - a couple of weeks ago Reply

Eric,

This is a really cool automation! Thanks for all your work on this. I do a lot of automations as well. I have a website and Youtube channel that explains some of my routines.

Recently I purchased a 4k Fire Stick because I discovered that having a 4K TV does not enable one to steam Amazon Prime content in Ultra HD. I discovered that one needs a 4k Fire Stick to stream available content in Ultra HD.

When installing the 4K Fire Stick I found that I had the option to pair my Onkyo receiver, to be enable it to be controlled, (on/off & volume) via the Fire Stick. This is really cool because now I no longer need multiple remotes to turn on and off my LG TV and Onkyo receiver in order to stream content. I simply hit the “on/off” button on the Firestick and the TV & receiver turn “on” or “off” simultaneously. Additionally, the TV input is automatically set to HDMI1 and the audio output is set to optical in order to feed audio to my Onkyo receiver

Then I noticed that my Onkyo receiver was showing in the list of smart devices on my alexa app. This caused me to speculate whether I might be able to control the receiver with SmartThings. I then began searching for a way that I could get my SmartThings hub to recognize the Onkyo receiver. Thus I found your article.

I still am not sure that your setup will help me. I got stuck at the SmartThings setup as I am still using the Classic App. I set the ‘virtual switch’ that you help me create as a Virtual Device in the Classic App and brought it into the Alexa App as a skill called “Basement Group” I figured I could just tell Alexa to turn on Basement Group and all the devices, (including the Onkyo receiver) would turn on. However it appears my logic appears flawed. Do you think that a dumb device like my Onkyo Receiver can be automated? If so, perhaps my setup in the SmartThings Classic App need to be altered. Can you provide setup instructions for the SmartThings Classic App?

    Eric Blank - a couple of weeks ago Reply

    If you can create a routine in the Alexa app to control your device, this procedure is basically a way to access that routine in SmartThings. I have not used the Classic app in awhile.

Evan Dodd - 6 days ago Reply

Thanks for the guide, I am wondering will this work for the Samsung buttons? I can get the “Open” to work just fine, but I cant get it to work when I want it to “Close”
Thanks!

Leave a Comment: