Command¶
The Command node obtains device control commands to trigger integration flows.
Applications can invoke EnOS open APIs to send control commands to devices in IoT Hub, and if the device is online, and the Command node will obtain the corresponding control command information such as the product key, device key, command ID, etc. which is in the EnOS standard format. To convert the data to a format suitable for other devices/systems, you can use the Script node.
Two open APIs are available for applications to invoke: Set Measurement Point and Invoke Service.
Node Type¶
IoT Hub.
Input and Output Ability¶
This node does not have an entry point and has 1 exit point. Both the input and output are JSON.
Node Properties¶
Name
The name for this node.
Product
The product of the devices to send the commands to.
Description
The description for this node.
Limitations¶
Only one product can be selected.
Samples¶
Input Sample¶
After invoking the Set Measurement Point or Invoke Service API, the Command node will automatically obtain information such as the specified device’s command ID, product key, command type, etc.
Output Sample¶
Command Type: Set Measurement Point¶
After invoking the Set Measurement Point API, the Command node will automatically obtain information such as the specified device’s command ID, product key, command type, etc. and output as msg.
The key and value for the key:value in inputData
will be the measurement point identifier and value to be set respectively. For example, to set a temperature of 30.5 degrees, the key will be temperature and the value 30.5.
{
"commandId":"commandId",
"productKey": "UgbJtiGV",
"deviceKey": "104zf_test_js",
"assetId": "iSNiomzT",
"commandType":"setMeasurementPoint",
"tslIdentifier":"temperature",
"inputData": {
"temperature": 30.5
}
}
Command Type: Invoke Service¶
After invoking the Invoke Service API, the Command node will automatically obtain information such as the specified device’s command ID, product key, command type, etc. and output as msg.
The tslIdentifier
is the identifier of the service defined in the model and the key:value in inputData
will be according to the service feature definition defined in the model where the value can be of string, integer, array, etc.
{
"commandId":"commandId",
"productKey": "UgbJtiGV",
"deviceKey": "104zf_test_js",
"assetId": "iSNiomzT",
"commandType":"invokeService",
"tslIdentifier":"tslIdentifier",
"inputData": {
"parameter_1": 1.3,
"parameter_2": 13
}
}