Difference between revisions of "Device Preferences"

From Hubitat Documentation
Jump to: navigation, search
(Provides information on defining preferences for a driver)
 
 
Line 1: Line 1:
==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==
+
<big>'''We're moving!''' Please visit http://docs2.hubitat.com for the latest documentation.</big>
metadata {
 
    preferences {
 
        ...
 
    }
 
}
 
  
==Entries==
+
<big>
Each entry within the preferences section is an <code>input</code> which is a single setting for the device.
+
This document is available at: http://docs2.hubitat.com/en/developer/driver/preferences
 
+
</big>
===Input===
 
Each input must have a <code>name</code> and <code>type</code>. Depending on the <code>type</code> 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 <code>bool</code>, <code>date</code>, <code>decimal</code>, <code>email</code>, <code>enum</code>, <code>number</code>, <code>password</code>, <code>time</code>, <code>text</code>.
 
:: 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 <code>enum</code>. Allows you to specify the values that appear in the dropdown.
 
:: multiple - Only available when the type is <code>enum</code>. Specifies that multiple values can be selected from the dropdown.
 
:: range - Only available when the type is <code>number</code> or <code>decimal</code>. A string in the format <code>low..high</code> that specifies the range of valid numeric values.
 
 
 
==Example==
 
preferences {
 
    input name: "settingName", type: "text", title: "My Setting", description: "Enter Setting Text", required: true
 
}
 

Latest revision as of 04:02, 25 September 2022

We're moving! Please visit http://docs2.hubitat.com for the latest documentation.

This document is available at: http://docs2.hubitat.com/en/developer/driver/preferences