The driver preferences provides the Hubitat Elevation hub with user settings for the driver. Preferences for a driver are more simplistic than the preferences for an app as they all appear on a single page. Preferences are also different from an app in that they are defined within the metadata block.
metadata {
preferences {
// ...
}
}
Each entry within the preferences section is an input which is a single setting for the device.
Each input must have a name and type, though a title is also recommended. Depending on the type, additional parameters may also be supported. Possible input parameters:
name - Uniquely identifies this setting
type - The data type of the setting which may be one of bool, date, decimal, email, enum, number, password, time, text (with behavior generally similar to those of app preferences)
title - The text to be shown in the driver UI
description - The long text description of the setting (optional or "")
required - Specifies whether or not this setting requires a value before the UI allows saving (true or false)
defaultValue - The default value displayed for the setting if none is specified
options - Only available when the type is enum. Allows you to specify the values that appear in the dropdown.
range - Only available when the type is number or decimal. Specify a String in the format "low..high" with the range of valid numeric values, e.g., "0..10".
The name and type may also be given as the first arguments, followed by any other parameters: input "settingName", "text", title: "My Setting". If not specified, description defaults to "Click to set" and required defaults to false.
Inputs may optionally be grouped into sections, either untitled (section { ... }) or with a title (section("Section Title") { ... }). Inputs outside any section are placed in a default section.
preferences {
input name: "settingName", type: "text", title: "My Setting", description: "Enter Setting Text", required: true
}