Boolean input to enable/disable app without uninstalling

I don’t see an on/off input type (preferably presenting a slider in the UI) to enable or disable my app (it’s an after-hours alarm).

What sort of clever workarounds are folks using to provide Boolean input?

Is there a way to set a default value for an input?

Preferences & Settings

Yes, you can use a boolean input and it provides an On/Off slider (at least in iOS it does; I imagine it does similar in the Android / Windows Phone apps)

input “appEnabled”, type: “bool”, title: “ON=Enabled, OFF=Disabled”, required: true, defaultValue: true

Then, where needed in your code:

if (settings.appEnabled) {
// App is enabled, do these things
} else {
// App is disabled, don’t do anything
}

1 Like

Whoa! Looks like you found some old docs that I wasn’t even aware of. :hushed:

Those docs are outdated. I’ll track down the source and get that cleaned up.

Here are the current docs that are updated fairly regularly: http://docs.smartthings.com

And the section on preferences (you can use a ‘boolean’ input type): http://docs.smartthings.com/en/latest/smartapp-developers-guide/preferences-and-settings.html

How/where did you find those docs, BTW? :

Someone whose handle is DanLieberman posted them to GitHub 9 months ago. If that was a copyright violation, you can have them taken down.

https://github.com/danlieberman/rtdTest/tree/master/smartapp-developers-guide

1 Like

This would actually be a great feature within the iOS and Android app itself (or at a minimum in the IDE). I would love the ability to enable/disable apps or devices temporarily for troubleshooting or other reasons.

(Did I read this thread correctly? :slight_smile: )

Thanks @JDRoberts. I tracked it down and we’ll get it corrected (no copyright violation or anything, just an apparent old test docs location that never got cleaned up)