This guide assumes familiarity with the following information:
In this guide, you'll learn how to create a simple action flow to send a SmartThings command using two nodes. The device used in this guide is a SmartThings-enabled light bulb.
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 you model the behavior of a device in response to a voice command in a visual, intuitive, and hands-on manner.
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.
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.
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:
Command Node can be used to send a command to a SmartThings device. The
Start Node you added earlier triggers the
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
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.
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:
Click APPEND NEW ITEM to open the Node Configuration menu as shown below:
Select the component using the menu. For this example, select the
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
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.
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 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.
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 or using subgraphs.
For additional examples, see the "Set the Brightness of the Device" Sample Graph and the "Play the Next Song on the Device" Sample Graph.