Device trigger
A device trigger node initiates a service workflow using data reported by a device, such as properties, events, or status changes. This node also supports using a virtual device to report data, allowing you to test and customize service flows that respond to specific device information.
Node configuration
On the business logic editor page, in the list, drag the Device Trigger node to the canvas and configure it.
| Parameter | Description |
| Node name | The node name. It can contain Chinese characters, letters, digits, and underscores (_) and must be 30 characters or less. |
| Select product | Select the product that triggers the service. |
| Select device | Select All Devices or a Specific Device from the product. After you select a device, the system assigns one for online service debugging. For debugging details, see Step 3: Debug. Important You cannot use a single device in more than 10 device trigger services simultaneously. |
| Trigger condition | Select whether the service is triggered by all or specific instances of Property Reporting, Event Reporting, or a Status Change. |
Node output
- Output data format for property reporting:
{ "deviceContext": { "productKey": "The productKey of the device", "deviceName": "The deviceName of the device", "gmtCreate": The creation timestamp of the device }, "props": { "PropertyIdentifier": { "time": The timestamp when the data was reported, "value": The value of the reported property } } } - Output data format for event reporting:
{ "deviceContext": { "productKey": "The productKey of the device", "deviceName": "The deviceName of the device", "gmtCreate": The creation timestamp of the device }, "event": { "EventIdentifier": { "outputs": { "OutputParameterIdentifier": "Output parameter value" }, "eventCode": "Event identifier", "eventName": "Event name" , "eventType": "Event type (info/alarm/fault)" } } } - Output data format for a status change:
{ "deviceContext":{ "productKey":"The productKey of the device", "deviceName":"The deviceName of the device", "gmtCreate":The creation timestamp of the device }, "status":{ "time":The timestamp of the status change, "value":"Status value" }, "dataSource":{ "status":"Status value" } }
| Field | Description | Example |
| deviceContext | Device information. | |
| props | The properties reported by the device. This field appears when the selected reporting type is Property Reporting. For details about the content of the props field, see the Feature Definition page for the product. |
|
| event | The events reported by the device. This field appears when the selected reporting type is Event Reporting. For details about the content of the event field, see the Feature Definition page for the product. |
|
| status | Status change information. This field appears when the selected reporting type is a Status Change. For details about the content of the status field, see the Feature Definition page for the product. |
|
| dataSource | The current status information. This field appears when the selected reporting type is a Status Change. | |
Use the node output in downstream nodes
To use reported properties or events in other service nodes, you can either query for specific parameters or select this node as a data source for downstream nodes.
- Access data by using a query.
When configuring a downstream node, such as a script node or a DingTalk chatbot node, you can use a query to reference property or event data. For example:
query.props.PropertyIdentifier.value: References the value of a specific reported property.query.deviceContext.deviceName: References the device name.query.event.EventIdentifier.eventName: References the name of a specific reported event.
Example of configuring a DingTalk chatbot to use reported property data:
In the Node Configuration panel of the DingTalk chatbot node, set Configuration Method to Custom and Message Type to text. In the Content Configuration area, enter the JSON message body. Set thetext.contentfield to{{query.props.humidity.value}}to reference the reported humidity property value. You can also specify the mobile numbers to mention in theat.atMobilesfield. - Access data by using configuration items.
When configuring a downstream node, such as a condition node or a switch node, you can select a specific data type from the device trigger node as the data source.
To do this, go to the Data Source area and select the From Node tab. Select the Device Trigger node, and then choose a data type from the list, such as Online Status, Reporting Time, Reporting Device Name, or Room Humidity.