Sending a Device Command

This guide assumes familiarity with:

In this guide, you'll learn how to create a simple action flow to send a SmartThings command using two nodes.

What is an Action Flow?

An action flow is a graph containing different types of nodes connected by execution and data paths. By associating a voice intent with an action flow, you specify the behavior the device should exhibit for that voice intent.

Action flows are the most important feature of Bixby Home Studio (BHS). They let us model the behavior of a device in response to a voice command in a visual, intuitive, and hands-on manner.

Start Node

Every action flow must begin with a Start node. The Start node gets triggered when the user gives Bixby a command. This command is the starting point for the action flow.

Begin by dragging the Start node from the Action Flow Nodes sidebar on the left onto the editor area.

The Start Node

Now you have an action flow in place. It consists of a Start node that gets triggered when the user utters a command. However, after the Start node gets triggered, nothing happens.

To get a response based on the voice intent, you need to add more nodes to the action flow, which perform actions when triggered.

Let's modify the action flow to send a command to a device.

Sending a Command

You can make the Start node trigger another node by connecting the two nodes with an execution path.

In the example below, the intended action is to switch on a light. So, you have to add a node that enables you to send a relevant command to the device.

To do this, drag a Command node to the flow editor area as shown below:

Adding a Command Node

A Command node can be used to send a command to a SmartThings device. The Start node you added earlier triggers the Command node.

Execution Path

For a node to trigger another node, you connect the output trigger port of the first node to the input trigger port of the second one. By doing so, you specify that when the first node finishes processing, it should trigger the second node.

Connect the output trigger port of the Start node to the input trigger port of the Command node as shown below. You can do this by clicking on the output trigger port of the Start node and then dragging the path line until it connects to the input trigger port of the Command node.

Connecting the Start Node to the Command Node

This path allows the control or execution of the flow to pass from one node to the other, thus forming an execution path. The execution path from the Start node to the Command node ensures that the Command node gets triggered after the Start node gets processed.

Command Node Configuration

You have now connected the Start node to the Command node, but haven't set the command to execute when the Command node is triggered.

To do this, click on the Command node to select it. This expands a Node Configuration window on the right as shown below:

Node Configuration Menu Append New Item Button

Click APPEND NEW ITEM to open the Node Configuration menu as shown below:

The Node Configuration Menu

Select the component using the drop-down menu. For this example, select the switch capability from the drop-down menu.

Note

Most devices have only one operating section or compartment. In this case, the only option for component is main. If a device has many sections or compartments that you can operate independently, there will be multiple component options, such as top, bottom, and middle.

Selecting a Command

This opens a window showing the available commands for the selected switch capability. Select the required command, in this case on, and click SAVE. You don't need to enter arguments in the Node Configuration menu. To learn more about arguments, read the Sending a Device Command with an Argument guide.

Saving the Configuration

Great! You've now created an action flow that sends a switch on command to a light.

The editor also has the "Try It" feature, to test the action flow on a real device. You can do this without uttering voice commands. Click TRY IT in the menu bar at the top right.

The Completed Action Flow

The device should now be switched on. A dashed green flowing line will highlight the execution path, as shown below. Any obtained values or responses will appear below the corresponding nodes.

The Execution Path

Great! You've successfully created and tested an action flow for a voice intent. You can also add action flows for voice intents that you want to include in your voice metadata.

The action flow you made in this guide is a pretty basic one. You can also make more complex ones by adding different types of nodes.

In the next guide, you'll learn how to send a device command with an argument, so the device can set a value based on the user's utterance.