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 the paylaod in the output settings using the this
syntax as follows:
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 fails 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, but not be included in the payload.