Device Preferences

From Hubitat Documentation
Jump to: navigation, search

Overview

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.

Structure

metadata {
    preferences {
        ...
    }
}

Entries

Each entry within the preferences section is an input which is a single setting for the device.

Input

Each input must have a name and type. Depending on the type additional settings may also be required.

Input Settings

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.
title - The text to be shown in the driver UI
description - The long text description of the setting
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.

Example

preferences {
    input name: "settingName", type: "text", title: "My Setting", description: "Enter Setting Text", required: true
}