-
Notifications
You must be signed in to change notification settings - Fork 3
Test
Main Methods
preferences()
Returns set of preferences that will be displayed to user in the mobile app.
sections: A list of maps each containing 'title' and 'input' keys
title: A string that will be displayed to the user describing the section. Ex. "Choose your lamp", "Remind me at..."
input: Contains a map that holds the section's variables
name: A string that represents the variable name you will use in your code. Ex. "phone1", "switch2"
title: A string that will be displayed to the user describing the selection box. Ex. "Where?", "What time?", "Phone number?"
type: A string describing the type of variable. See SmartApp Input Types below:
description: A string that will be displayed to the user that will be the default selection. Ex. "Tap to set"
multiple: A boolean that sets whether the selection box allows multiple devices to be selected. Ex. true, false
Example:
def preferences()
{
return [
sections: [
[
title: "When there's motion...",
input: [
[
name: "motion1",
title: "Where?",
type: "device.motionDetector",
description: "Tap to set",
multiple: false
]
]
],
[
title: "Turn on a fan...",
input: [
[
name: "switch2",
title: "Which?",
type: "device.switch",
description: "Tap to set",
multiple: false
]
]
]
]
]
}