Dynamic Widget Params

Dynamic parameters for device widgets

Overview

The device level dashboard, configurable via the Models area, supports a number of different Widgets types and options. Widgets can be configured with static values (e.g. which telemetry to monitor, what unit of scale is used, etc) or some via dynamic parameters based on the device's configuration.

The following Widget types currently support dynamic parameters:

  1. Spline Chart

Spline Chart

Static Setup

Manufacturers can provide a list of measurements for each device. Each measurement must include metadata from the device's historical state data:


  1. Display Name - Measurement name displayed to the end customer.
  2. Telemetry - What key in the telemetry data sent by the device should be tracked (must be an numeric key).
  3. Unit - [Optional] Unit type displayed to the end customer.

Dynamic Setup

Dynamic mode allows widget data to adjust based on device configuration, settings, or hardware, reducing noise from unused measurements.

For example when a device has 10 possible temperature sensors, each sending on telemetry key "temperature_X" (X being the id of the sensor). We can set up the Spline Chart Widget to show all 10 telemetry keys. But if each device can in practice have only a few sensors installed, this can create a "noisy" chart for the end customer.

To allow the manufacturer to show only the "active/installed" sensors, the Spline Chart Widget can be switched to the "Dynamic" mode. In this setup the list of measurements does not need to be setup in advance and can rather be dynamically obtained for each device, based on that device's Configuration or Details (see Data Types)

The list of measurements to display on the Spline Chart Widget must be encoded as a JSON array of objects, with each object containing the following keys:

KeyTypeDescription
namestringName of the measurement displayed to the end customer
unitstring[Optional] Unit displayed to the end customer
telemetrystringThe name of the telemetry key sent by the device
descriptionstring[Optional] Longer description of the measurement - Currently not displayed to the end customer

The above information must be somewhere in the device's Configuration or Details (see Data Types) and can be deeply nested. The string provided in the "Path" of the dynamic parameters, must point to the location and contain the array of objects.

For example, given the following configuration JSON:

{
  "inputs": 10,
  "sensors": [
    {
      "temperature": [
        {
          "name": "Outside porch",
          "unit": "c",
          "telemetry": "temperature_outside_3",
          "description": "Outside porch temperature sensor"
        },
        {
          "name": "Living room",
          "unit": "c",
          "telemetry": "temperature_inside_2",
          "description": "Living room sensor"
        }
      ]
    }
  ]
}

The path parameter to the measurements to display will be: config.sensors[0].temperature

  1. config Data should be taken from the configuration object (detailsfor device's details section)
  2. sensorsAccess the "sensors" key
  3. sensors[0]Access the first item in the array of sensors
  4. temperatureAccess the "temperature" key inside the first sensor object.

When a user opens the device view, the widget dynamically retrieves the correct measurement list to display, based on the device configuration object.