typeproperty that determines what values it can have and how it is presented to the user. The
valueproperty of each setting is the initial value of the setting, this property is required for all settings. The following setting types are supported:
string. You can optionally validate the value using a regex pattern by adding a
patternproperty. For example adding
"pattern": "[a-zA-Z]"to the setting definition will make sure the user can only input letters.
passwordbehave the same as
textbut the input is visually hidden.
textareatype settings behave the same as
textbut allow multi-line input.
numbertype settings can only contain numbers, this means that the
valuemust also be a number. Number settings also support
stepproperties. You can also optionally provide the unit of the setting by setting the
checkboxsettings can be
dropdownallow the user to pick a value from a predefined set of choices. The values of the checkbox must be strings.
typegroup to your settings to group multiple settings together with a label.
label. This acts as a read-only text field and can only be updated by your app.
Deviceclass. You can retrieve the current values of all settings as follows:
Device#onSettings()will be called. You can overwrite the method in your
device.jsto react to changes to the settings. It is also possible to throw an error from this method if the settings are invalid. The thrown error will be shown to the user and they be asked to change their settings in order to store them.