Skip to Content

Integrating SmartThings with Alexa Routines

Integrating SmartThings with Alexa Routines

One of the hardest things to do right now is to trigger Amazon Alexa routines with any device or any condition from Samsung SmartThings.

Right now, what you can do is attach Contact and Motion Sensors to Alexa and use those to trigger Alexa Routines, but what if you want to trigger with something like a Leak Sensor? What about temperature? Humidity? Lighting levels? What about a certain time of day, plus the presence of someone in your home?

Let’s talk about it!

By continuing to use this website you agree to our Terms of Use. If you don't agree to our Terms, you are not allowed to continue using this website.

Ways to Trigger Alexa Routines with SmartThings

These are the kinds of requests I get each and every day on Automate Your Life. So, I went out and found a solution.

Now, full credit to BJ Pierron who wrote this Device Handler code for a specialized device type that will allow you to do this.

The simulated Alexa Switch code for SmartThings is provided by ‘bjpierron’: https://raw.githubusercontent.com/bjpierron/SmartThings-Alexa/master/devicetypes/bjpierron/simulated-alexa-switch.src/simulated-alexa-switch.groovy

Simulated Alexa Switch by BJ Pierron

/**
 *  Copyright 2015 SmartThings
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
metadata {

    definition (name: "Simulated Alexa Switch", namespace: "bjpierron", author: "bjpierron") {
        capability "Switch"
        capability "Sensor"
        capability "Actuator"
        capability "Contact Sensor"	    		
    }
    
    simulator {
		status "open": "contact:open"
		status "closed": "contact:closed"
	}

    tiles {
        standardTile("switch", "device.switch", width: 2, height: 2, canChangeIcon: true) {
            state "off", label: '${currentValue}', action: "switch.on", icon: "st.switches.switch.off", backgroundColor: "#ffffff"
            state "on", label: '${currentValue}', action: "switch.off", icon: "st.switches.switch.on", backgroundColor: "#00A0DC"
        }
        main "switch"
        details(["switch"])
    }
}

def parse(description) {
}

def on() {
    sendEvent(name: "switch", value: "on")
    sendEvent(name: "contact", value: "open")
}

def off() {
    sendEvent(name: "switch", value: "off")
    sendEvent(name: "contact", value: "closed")
}

Now, to implement all of this, it would help if you watch the video below. Check it out!

How to Trigger Alexa Routines with Anything from SmartThings

What can trigger an Alexa routine?

A voice command, an alarm, a scheduled time, or a smart home device interaction can trigger an Alexa routine.

Routines save you time by grouping together a bunch of actions so you don’t have to ask for each one individually. You can activate routines via voice, time, or with your smart devices, and more.

You should check out the Featured Routine in the Alexa App to find out more!

Why won’t Alexa do my routine?

The reason why your Alexa Routine may not be working is, perhaps it wasn’t enabled.

So, to enable the Alexa Routine, here are a few fixes you should try:

  • Make sure your device isn’t muted.
  • Test your Alexa Routine.
  • Check the trigger phase.
  • Check the devices listed in the routine.
  • Reboot your device.

If you’re planning to buy Alexa at Walmart, I have created this short guide for you. Read it!

In Summary

You can trigger Alexa Routines with SmartThings via voice, time of the day, or a smart device. Make sure your Routine is activated to ensure it’s going to work.

I suggest watching a few video tutorials to learn how to integrate the Routine into SmartThings. Also, feel free to reach out to us if you need help!

Click here to view the visual story version of this article

Aur-El

Friday 1st of April 2022

Thank you so much guys! I was able to modify the code to also acts as a motion sensor, now i can use all my Echo paired Zigbee devices into the smarthings app.

Mike

Wednesday 12th of January 2022

I tried the above fix. I was able to get the device handler and the device uploaded. When I go to the app the simulated switch does not show in routines. It does show up as a device. There is a note at the bottom of the list of available devices that says devices without available conditions aren’t shown. Any suggestions?

Ankur

Wednesday 5th of January 2022

Thanks Alan, appreciate your work – this is super helpful. This works well with almost all devices. The only routine I am not able to run is getting Alexa to open garage door or driveway using a YoLink controller (i.e. as a trigger switch instead of a passive switch). This may be an Alexa restriction. Because when I go to create an Alexa routine where ST virtual switch triggers a YoLink controller in Alexa, it shows that my only option is to CLOSE the YoLink garage/driveway controller, with no option to OPEN. So it’s great if I forgot to close the garage and need to close it. But not if I lost my physical controller and want to open it from ST app.

Tom

Tuesday 27th of April 2021

This is nice, simple, and just what I needed! THANKS!!

Alan Varughese

Saturday 22nd of May 2021

You're welcome Tom!

John

Thursday 19th of November 2020

Works GREAT!!!! I'm new to the smart game. I have a lot of different products that are all now work with Alexa now!

Thanks

Alan

Thursday 19th of November 2020

That's great John. It's exciting to see everything start to work!

Skip to content