IFTTT Triggers

If you use an iPhone, you may be interested in our upcoming SmartRules app - http://smartrulesapp.com. This app will give you the ability to easily create rules, similar to IFTTT, but more flexible, and they run locally on the ST cloud, so you’ll get the same speed as a SmartApp. We’re finishing up beta testing now and will be releasing soon.


I thought I made a suggestion about this on their Feature Requests - can’t find it though… :unamused:

I wanted triggers that could activate “Hello and Goodbye”.

For Instance: If Nest set to Away, Then ST set to Goodbye".

Seems simple enough.

1 Like

It does seem simple, but at the present time the SmartThings IFTTT channel can only turn things on and off, and do a few more things specific to thermostats.

However, if you’re willing to do a small bit of custom code, you can set up a virtual switch through SmartThings, and then have IFTTT turn that “on” or “off” and change the SmartThings Mode that way. This is called a “man in the middle” protocol.

It’s a little convoluted, obviously, but it does work.

I am using IFTTT to provide voice control via Hey Siri for my SmartThings installation. I was initially very concerned about the lag as well, but have since found that if you are triggering off of a text or email, as the method I’m using does, there’s almost no lag at all, it’s clear that IFTTT is processing those requests on demand. However, if I just set up a recipe to trigger “when a switch is turned on,” then, yes, it might take 15 minutes until IFTTT gets around to polling for the change. All makes sense. The point is just that some IFTTT recipes can be set to trigger very quickly, but not the ones relying just on device state change.

Custom Code? how much of this is actual coding? (writing if, thens, loops, etc by hand). How would you suggest I start? link?

Here is the FAQ for creating a virtual switch.

After that it depends on what you want to do with it. A virtual switch can be any of several types, but for IFTTT mode changing you probably want a simple binary (on/off) switch.

The virtual switch doesn’t really exist, but the network will act as though it does, including letting you change it from the mobile app and telling IFTTT that it has turned on/off.

Is it up to SmartThings to allow IFTT access to Phrases and Mode changes?

Yes, and so far they haven’t.

What I’d really like to see SmartThings add is a way to create virtual switches and virtual presence sensors easily right in the mobile app, without touching the IDE. That would be a plug and play solution for noncoders. Then they could use IFTTT or use the virtuals for other purposes and never have to see a line of Groovy. :blush:


How about some new Actions? Particularly a Toggle action like the WeMo channels have. This way you don’t need two separate recipes to turn things on and turn things off.

You can make a momentary push button device and use the follow smartapp code.

name: “Momentary Toggle”,
namespace: “smartthings”,
author: “SmartThings”,
description: “Toggles light state”,
category: “Convenience”,
iconUrl: “https://s3.amazonaws.com/smartapp-icons/MyApps/Cat-MyApps.png”,
iconX2Url: “https://s3.amazonaws.com/smartapp-icons/MyApps/Cat-MyApps@2x.png”,
iconX3Url: “https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png”)

preferences {
section(“Real Switch…”) {
input “realswitch”, “capability.switch”,
title: “Real Switch…”,
required: true
section(“Virtual Stand-in…”) {
input “standin”, “capability.switch”,
title: “Stand In Virtual Switch…”,
required: true

def installed() {
subscribe(standin, “switch.on”, switchOnHandler)
subscribe(standin, “switch.off”, switchOffHandler)

def updated() {
subscribe(standin, “switch.on”, switchOnHandler)
subscribe(standin, “switch.off”, switchOffHandler)

def switchOnHandler(evt) {
state.wasOn = realswitch.currentValue(“switch”) == "on"
state.wasOff = realswitch.currentValue(“switch”) == "off"


def switchOffHandler(evt) {


Thanks @RobtheEngineer! I created the momentary button but I’m having trouble wrapping my brain around the smartapp you shared. its looking for a real switch and a stand in virtual switch… Do I need to create another virtual switch and add it here as the stand in?

The push button will be the virtual switch and whatever switch (ie bedroom light) you want to toggle off and on will be your real switch.

ahhh, got it. it finally hit me. this works great. especially with the DO button. thanks!

It’s actually @bravenel code that I modified to work with a push button. So I could turn lights on and off with a misfit flash.

Thanks Bruce.

1 Like

Hi Robert, I just picked up a Misfit Flash today on a whim (it was $6, so I couldn’t just leave it there :smile: ).

Is the code posted earlier in this thread all I need to use the Flash as a button to trigger IFTTT?


Through the app for the Flash it connects directly to IFTTT and you use IFTTT to turn on a switch in Smartthings.

With IFTTT you can only turn on or turn off a switch, the code above allows you to turn on and off a switch.

Just out of curiosity, what IFTTT triggers and actions would you guys like to see added to the SmartThings channel?

1 Like

Modes, routines and motion stops, please for triggers. Dim level for actions.

Ability to change mode (mode as action.)

trigger from mode change (mode as trigger)

Ability to trigger a routine (routine as action)

Armed Status for SHM as both trigger and action (all of them)

Presence as a trigger

Dim level as an action for devices that support it

1 Like

Ability to detect a failed routine and to remediate it.