Mode Change Endpoints

(Impliciter) #1

I’ve been trying to figure out how to expose mode selection via endpoints. Has anybody done this?

I’ve followed along the switch endpoints and got the setup easily but am having trouble finding any documentation related to mode endpoints.

(Steve) #2

Hey Impliciter,

There are 2 different mode elements that you can use. If you want the SmartApp to only execute in a specific mode, you can use:
mode(name: “executeInMode”, title: “Only execute when in this mode”)
You don’t need to do anything more in that case because SmartThings will handle it for you.

If you want to execute a mode manually, you can use:
input(type: "mode", name: "executeThisModeManually", title: "Which mode would you like to change to?")
Then in your handler method you would set the mode like this:

def myHandler() {
    if (executeThisModeManually)