...
Support added end of April 2022.
This new format is now what should be used for all new templates.
The Legacy
form_settings
format will still work in older templates.Old templates can be updated to the new format by simply editing the template . Note that existing and re-saving with the newly changed form_settings.
Existing Paired devices will continue to use existing settings (e.g. it pulls the default units from template).
If you define new units in the form_settings, the user simply needs to Refresh their screen to see the new options - there’s no need to re-add device.
If form_settings are updated and a user with existing Paired device wants to take advantage
without re-adding, they can simply open Settings for device, make selections in the new dropdowns and click Save.
form_settings
with Individual channels format:
...
Code Block |
---|
[ { "order": 0, "label": null, "variables": [ { "order": 0, "label": "Temperature Unit", "type": "string", "min": null, "max": null, "form": "select", "key": "child.3.unit", "default_value": "f", "required": true, "values": [ { "value": "f", "label": "°F", "short": "°F" }, { "value": "c", "label": "°C", "short": "°C" } ] }, { "order": 1, "label": "Barometric pressure Unit", "type": "string", "min": null, "max": null, "form": "select", "key": "child.13.unit", "default_value": "hpa", "required": true, "values": [ { "value": "pa", "label": "Pascal", "short": "Pa" }, { "value": "hpa", "label": "Hectopascal", "short": "hPa" } ] } ] } ] |
where 3 is the channel as indicated byThe Key should match the Channel as defined in the template.
For example Channel 3 (Temperature) from this template is matched with:
Code Block |
---|
"key": "child.3.unit" |
The value
in values definition should match the Payload
from the template’s Units:
For example adding an entry to match “Hectopascals” would use "value": "hpa"
. The short
and label
can be used to display nice text to the priority isuser.
Code Block |
---|
"values": [
{ "value": "hpa", "label": "Hectopascal", "short": "hPa" } |
...
Note on priority matching:
Code Block |
---|
1. properties.child.X.unit 2. properties.unit (if it is a valid unit for the sensor) 3. the unit marked as "default" for the capability if the sensor has console capability 4. sensor.unit, not sure where it is defined, but might be the standard unit API returns 5. no unit ("null" unit is also not shown) |