Skip to main content

Device: Command Node

The Device: Command Node allows a workflow to send a command to one or more devices.

Device Command Node

Node Properties​

There are three parts to configuring a Device: Command Node - selecting the devices to send the command to, configuring the command name, and optionally creating a payload to be sent with the command.

Sending a Command to Specific IDs and Tags​

To send a command to specific devices by IDs and tags, choose Select specific devices and tags in the Selection method... dropdown. This will expose the Device field, where you must select at least one device or tag.

Sending a Command to Device(s) by Payload Path​

To send a command to one or more device IDs off of the current workflow payload using a payload path, select Use Device ID(s) specified on the current payload in the Selection method... dropdown. This will expose a required Device ID(s) JSON Path field. The path must resolve to either a single device ID string or an array of device ID strings. This option allows a workflow to dynamically change what specific devices are being sent a command depending on the payload currently being processed.

Sending a Command to Devices by Advanced Query​

To send a command to multiple Devices using an advanced query, choose Select devices by query in the Selection method... dropdown. This will expose an advanced query input for defining which Devices to send the command to.

Configuring the Command​

The required Command Name Template field supports string templates, allowing the command name to be dynamically determined based on the current payload.

The command payload is optional. You can configure the payload using the Command Payload Type dropdown:

  • JSON Template: (Default) Resolves the payload from a JSON template entered in the Command Payload JSON Template field.
  • String Template: Resolves the payload from a string template entered in the Command Payload String Template field.
  • Payload Path: Resolves the payload from a payload path entered in the Command Payload Path field.

Node Example​

Device Selection​

Device Command Node Selection

In the example above, the first option is being used, and the node will send the command to all devices whose tag deviceType is equal to colorBulb.

Command Configuration​

Device Command Node Configuration

In the above example, the Device: Command Node is sending the command setHueColor with a payload. And given the following payload:

{
"time": Fri Feb 19 2016 17:26:00 GMT-0500 (EST),
"data": {
"voltage": 1.7,
"color": 1393
},
...
}

The Device: Command Node would send the following command payload with the setHueColor command:

{
"hue": 1393
}

Node Errors​

In the case of a device command failing to send, the workflow will halt and error at this node.

Node Throttling and Limits​

The Device: Command Node has the same throttling rules as using the API or the broker to send commands: It is limited to 30 calls in a 15-second window per device, or on average, 2 calls per second. The maximum message size for the Device: Command Node is 256KB.

Was this page helpful?


Still looking for help? You can also search the Losant Forums or submit your question there.