Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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)

Clone (using one key for multiple channels)

You can use cloning to show one input field that then gets used to set the units for multiple channels. You can either add a "clone_to_key": ”another_key” or you can use array support as well.

Example: Specifying one input that will also clone to one additional channel’s units

"clone_to_key": "child.502.unit",

Code Block
[
  {
    "order": 0,
    "label": null,
    "variables": [
      {
        "order": 0,
        "label": "Precipitation Unit",
        "type": "string",
        "min": null,
        "max": null,
        "form": "select",
        "key": "child.500.unit",
        "clone_to_key": "child.502.unit",
        "default_value": "in",
        "required": true,
        "values": [
          { "value": "in", "label": "Inches", "short": "in" },
          { "value": "mm", "label": "Millimeters", "short": "mm" }
        ]
      }
    ]
  }
]

Example: Specifying array so that the units will be cloned to multiple channels units

"clone_to_key": ["child.502.unit", "child.999.unit"],

Code Block
[
  {
    "order": 0,
    "label": null,
    "variables": [
      {
        "order": 0,
        "label": "Precipitation Unit",
        "type": "string",
        "min": null,
        "max": null,
        "form": "select",
        "key": "child.500.unit",
        "clone_to_key": ["child.502.unit", "child.999.unit"],
        "default_value": "in",
        "required": true,
        "values": [
          { "value": "in", "label": "Inches", "short": "in" },
          { "value": "mm", "label": "Millimeters", "short": "mm" }
        ]
      }
    ]
  }
]