Dynamic Outputs
Output settings can be set dynamically (i.e., changed based on the data being sent).
As an example, you may want to change the MQTT Output topic depending on the values in the data.
Reference payload data using the this
syntax as follows:
// Assuming the data being sent has temperature property
{{this.temperature}}
// Assuming the output has a child motor object with a speed property
{{this.motor.speed}}
Assuming you set up the MQTT topic as follows:
topic={{this.siteID}}/{{this.areaID}}/{{this.machineID}}
and the data written to a MQTT output looks like:
{
"siteID": "Portland",
"areaID": "Engineering",
"machineID": "Boiler1"
}
The topic would be set to Portland/Engineering/Boiler1
.
Dynamic outputs are supported on any text output fields. If a reference made is not in the payload (e.g., {{this.badAttribute}}
) the operation will fail with an appropriate error message.
Note: The Attribute Filter setting (see Outputs) can be used to remove attributes from the payload that is sent. In the example above, this could allow attributes to specify the topic, while removed from the write value.