Duplicate to Related Entities
Use this node to broadcast a message to all entities related to the originator — for example, forwarding a setFanSpeed command to all HVAC devices contained in a building asset, or propagating a battery-low alert up to the customer that manages the device. One output message is created for each matching related entity, with its originator changed to that entity.
Configuration
Section titled “Configuration”Relations query
Section titled “Relations query”- Direction — required.
From originator(originator is thefromside) orTo originator(originator is thetoside). - Max relation level — maximum depth for traversing nested relations (e.g.,
2follows relations of relations). - Fetch last level relation only — when enabled and max level > 1, only entities at the deepest level are returned.
- Relation filters — a list of filter criteria. Each filter specifies:
- Relation type — type of relation to match (e.g.,
Contains,Manages). - Entity types — acceptable entity types for the related entity (e.g.,
DEVICE,ASSET). Empty list matches any type.
- Relation type — type of relation to match (e.g.,
Message processing algorithm
Section titled “Message processing algorithm”- Identify the originator of the incoming message.
- Execute the configured Relations query starting from the originator.
- If no matching related entities are found, route via
Failure. - For each found related entity, create a copy of the original message with the related entity as its new originator.
- Enqueue all created messages and route them via
Success. Acknowledge the original message once all are enqueued.
Output connections
Section titled “Output connections”| Connection | Condition |
|---|---|
Success | One message per found related entity, each with that entity as originator. |
Failure | No matching related entities found, or an unexpected error occurred. |
Examples
Section titled “Examples”Example 1 — Duplicate to related devices
Section titled “Example 1 — Duplicate to related devices”Originator: asset Building A | Data: { "command": "setFanSpeed", "value": "HIGH" }
{ "relationsQuery": { "direction": "FROM", "maxLevel": 1, "filters": [ { "relationType": "Contains", "entityTypes": ["DEVICE"] } ] }}State: Building A has Contains relations to Device HVAC-1 and Device HVAC-2.
Result: two output messages — one originating from HVAC-1, one from HVAC-2, both with { "command": "setFanSpeed", "value": "HIGH" }.
Example 2 — Propagate alert to managing customer
Section titled “Example 2 — Propagate alert to managing customer”Originator: device Thermostat-Z1 | Data: { "alert": "battery_low" }
{ "relationsQuery": { "direction": "TO", "maxLevel": 1, "filters": [ { "relationType": "Manages", "entityTypes": ["CUSTOMER"] } ] }}State: Customer B has a Manages relation to Thermostat-Z1.
Result: one output message with originator Customer B and data { "alert": "battery_low" }.
JSON schema
Section titled “JSON schema”{ "$schema": "https://json-schema.org/draft/2020-12/schema", "title": "TbDuplicateMsgToRelatedNodeConfiguration", "type": "object", "required": ["relationsQuery"], "additionalProperties": false, "properties": { "relationsQuery": { "type": "object", "required": ["direction", "filters"], "properties": { "direction": { "type": "string", "enum": ["FROM", "TO"] }, "maxLevel": { "type": "integer" }, "fetchLastLevelOnly": { "type": "boolean" }, "filters": { "type": "array", "items": { "type": "object", "required": ["relationType", "entityTypes"], "properties": { "relationType": { "type": "string" }, "entityTypes": { "type": "array", "items": { "type": "string" } } } } } } } }}