Sensor Bar Widget
Widget Type: rc-sensor-bar
Shows the readings from a set of sensors. Configurable
Configuration
sources an array of sources to receive data from. Each source must return an object where the keys are the sensor names and the values are the sensor readings. Objects are merged together, so if multiple sources return the same sensor name, the last one to emit will be used.
sourceType Either telemetry
or service
expression A function that takes the data from the source and returns an object where the keys are the sensor names and the values are the sensor readings.
source The source to receive data from. Either a path to a telemetry topic or a service name.
sensors An object where the keys are the sensor names and the values are the sensor configurations.
displayName An optional string for the name of the sensor. Displayed above the value. Defaults to the sensor ID.
unit The unit of the sensor reading. Displayed under the value
precision Optional number of decimal places to display
timeoutMs Optional number of milliseconds to wait before displaying an orange timeout. Default is 5 seconds.
levels An array describing warning levels.
type Either normal
, warning
or danger
min The minimum value for this level. If not specified, any value less than max
will be considered this level.
max The maximum value for this level. If not specified, any value greater than min
will be considered this level.
columns Optional number of columns to display the sensors in. Defaults to the number of sensors.
Example
{
"sources": [
{
"source": "/rocos/agent/telemetry/heartbeat",
"sourceType": "telemetry",
"expression": "(data) => ({'TIM': data['payload']['tim'] % 1e3 / 1e2})"
}
],
"sensors": {
"TIM": {
"displayName": "Time",
"unit": "units",
"precision": 2,
"timeoutMs": 1000,
"levels": [
{
"type": "warning",
"min": 1,
"max": 5.0
},
{
"type": "danger",
"min": 5.0
}
]
}
},
"columns": 4
}