IFTTT mode changes


(Jeremy Whittaker) #1

I’m curious if there is anything in the works to allow mode changes in IFTTT? It would be nice if I could program my up24 to change modes when I wake up!


(Chrisb) #2

You could do it in a 'round about way… create a virtual on/off tile. Then write a SmartApp that watches this tile. When it turns on the app changes mode, and then turns off the tile.

Now just tie the IFTTT function to this tile.


(Jeremy Whittaker) #3

@chrisb thanks for the solution. This sounds like more than I want to dive into right now :slight_smile:


(Steve S) #4

FWIW, I did this to try to fix the ios mobile presence issues, and it has been helping. My wife’s phone used to lose presence state about 75% of days - now that still happens, but about 50% of the time the IFTTT “virtual presence” saves it.

I’m hopeful their “ios7 only” future version of the ios app fixes it for good…


(Jeremy Whittaker) #5

@Steve28 would you mind posting your code for this?


(Steve S) #6

@JeremyWhittaker - no problem. Here’s what I did

  1. Add an “On/Off Button Tile” device. This is will be the Switch that IFTTT toggles and the switch the app I wrote subscribes to.

  2. Add the SmartThings Channel to IFTTT

  3. Install the IFTTT app on your phone and create a geofence event rule that toggles the ON/Off button tile from step 1 to “on”

  4. Make a smart app like the one below. It subscribes to the “on” events from the On/Off Button Tile in step 1. When that tile goes “on”, it switches the mode from Away to Home.

Here’s the App:

/**
 *  IFTTT Presence Band-Aid
 *
 *  Author: Steve Sell
 *  Date: 2014-01-24
 */
preferences {
	section("Select Switch to monitor"){
		input "theSwitch", "capability.switch"
	}
}

def installed() {
	log.debug "Installed with settings: ${settings}"
    initialize()
}

def updated(settings) {
	log.debug "Updated with settings: ${settings}"
	unsubscribe()
    initialize()
}

def onHandler(evt) {
	log.debug "Received on from ${theSwitch}"
    if(location.mode != "Home") {
        setLocationMode("Home")
    } else {
    	log.debug "Already Home - ignoring"
    }
    theSwitch.off()
    sendSms(##########,"IFTTT Arrived")
}

def offHandler(evt) {
	log.debug "Received off from ${theSwitch}"
}

def initialize() {
	subscribe(theSwitch, "switch.On", onHandler)
    subscribe(theSwitch, "switch.Off", offHandler)
}

(Jeremy Whittaker) #7

@steve28 I got this all setup but I do not see a location awareness based IFTTT app that I’m using…

Are you using IOS Location for this? I have an Android.


(Steve S) #8

I have the IFTTT iOS app… maybe the android IFTTT app doesn’t have it yet? You have to activate the Location channel on the IFTTT website as well.


(Keith Croshaw) #9

@stevesell Thanks for this idea, I starting doing this before I looked at your code thinking I could write to a “simulated presence sensor” from a “simulated switch.” I then quickly realized there are no commands available for a presenceSensor. What a shame this doesn’t work as advertised.

Thanks!