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:
- 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:
- Display Name - Measurement name displayed to the end customer.
- Telemetry - What key in the telemetry data sent by the device should be tracked (must be an numeric key).
- 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:
Key | Type | Description |
---|---|---|
name | string | Name of the measurement displayed to the end customer |
unit | string | [Optional] Unit displayed to the end customer |
telemetry | string | The name of the telemetry key sent by the device |
description | string | [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
config
Data should be taken from the configuration object (details
for device's details section)sensors
Access the "sensors" keysensors[0]
Access the first item in the array of sensorstemperature
Access 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.