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 Device(s) by IDs and Tags, select Select specific devices and tags in the Selection method… dropdown. This will expose a required Device IDs / Tags field.

Sending a Command to Device(s) by Payload Template

To send a command to one or more device IDs off of the current workflow payload using a payload path templates, 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. 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, select 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 command name field supports string templates, so if the command needs to be dynamically determined, it is possible to alter the command based on the current payload. The command payload is optional, and depending on the needs of the command being sent, may or may not be needed. If the command payload is needed, it must be entered as a JSON template.

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 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:

  "error": {
    "message": "A message about the error that occurred"

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) - 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.