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
. Depending on the type
, additional parameters may also be required. 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
- [true/false] - Specifies whether or not this setting requires a value
defaultValue
- The default value of 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.
multiple
- Only available when the type is enum
. Specifies that multiple values can be selected from the dropdown.
range
- Only available when the type is number
or decimal
. A String
in the format "low..high" that specifies the range of valid numeric values, e.g., "0..10"
.
preferences {
input name: "settingName", type: "text", title: "My Setting", description: "Enter Setting Text", required: true
}