Toggle a SmartApp on/off

I recommend this: the ability to toggle an installed/configured SmartApp on/off.

So for example, suppose I’m in a room that I actually want to keep the lights off, and so temporarily I DON’T necessarily want motion to trigger a light to be turned on. As it stands right now, accomplishing this is very inconvenient: I have to uninstall the SmartApp, and then to turn the Smartapp back on, I have to go back and somehow find, install, and configure the SmartApp in the ever-so-confusing current categorical layout/UI of exploring smart apps (that’s a different topic altogether) that you can’t search by name (that’s also another different topic altogether) just to put it back like it was.

Why not let end users enable/disable (toggle) a SmartApp to an on or off state.

This is one hassle I have as a developer, and I’m already encountering this need when using my apps from a “normal” end users standpoint.

(I suppose one could mess with modes to accomplish the same thing, but this is also highly inconvenient. You have to deal with changing the mode for an app and also have to then change their current mode you are in, which would then affect all their other apps and things you have going on that you probably would like to keep running as installed/configured).

The code to implement this for the SmartThings platform should be pretty simple. Just a simple
if app = enabled then
’ execute app
else
’ do nothing

Then just allow end users the ability to toggle the app just like you would do to toggle wifi or bluetooth on your mobile device, etc.

@snoopbuild - Thanks for the suggestion. This feature has been on our backlog for some time, but I don’t know where it is on the priority list at the moment. I’ll bring it up again with our engineering team - the more we hear about community desire for features, the higher those features tend to rank.

+1 on this feature from me. Especially for dev testing, this would be fantastic.

This may or may not be an acceptable workaround for your particular app. But look through this code and see how it is toggling by touching the app (that little arrow on the right of the iPhone list of apps). Anyway, I tried…

/**
 *  Big Turn ON edited for toggling the app on/off
 *
 *  Author: SmartThings & wackware
 *
 */

preferences {
	section("When I touch the app, turn on...") {
		input "switches", "capability.switch", multiple: true
	}
    section("Run App at this time..."){
    	input "startTime", "time", title: "Start time?...", required: true
	}
}

def installed()
{
	state.runThisApp = True
	subscribe(app)
    schedule(startTime, doSomeStuff)
}

def updated()
{
	unsubscribe()
	subscribe(app)
    schedule(startTime, doSomeStuff)
}

def doSomeStuff() {
	if(state.runThisApp)		//is True so run
		switches?.on()
    else
    	return					//is false so skip it
}

def appTouch(evt) {
	if(state.runThisApp)
    	state.runThisApp = False
    else
    	state.runThisApp = True
        
    log.debug "Toggled run state to: $state.runThisApp"
    sendPush("Toggled run state to: $state.runThisApp")
}
1 Like

Any more ever come of this?

You can do this with an extra mode, that you don’t use for anything. You can add the mode in the IDE or in the mobile app by editing the location (Dashboard settings). Then, to disable a particular app, you simply mode restrict it to only run in the mode you aren’t using. That’s the disable action. To re-enable it, simply remove the mode restriction. Virtually all SmartApps have the ability to use a mode restriction, often hidden under “More Options”.

1 Like

Indeed…I can vouch for this method. He shared it in another thread, I tested it, and it works for me.
Thanks again, Bruce. :slight_smile: