This guide assumes familiarity with:
In this guide, you will take a look at how to create an action flow for sending a SmartThings command using two nodes.
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. They let us 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 Node menu onto the flow editor area.
Looks good! Now you have an action flow in place! It consists of a Start
node that gets triggered when the user utters a command.
But after that, it doesn't do anything! To achieve the response from the voice intent, you need to add nodes to our action flow, which, when triggered, perform actions.
Let's modify the action flow to send a command to a device.
You can make the Start
node trigger another node by connecting it to a path.
In this example, the action you intend to perform is to switch on a light. So, you have to add a node that enables you to send a command to a device.
Drag a Command
node to the flow editor area as shown below:
A Command
node can be used to send a command to a SmartThings device. To trigger the Command
node, use the Start
node you added in the previous step.
For a node to trigger another node, you connect the output trigger port of the first node to the trigger port of the second. By doing so, you specify that when the first node has finished processing, it should trigger the second node.
Connect the output trigger port of the Start
node to the trigger port of the Command
node as shown below.
This path allows the control or execution 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 the trigger of the Command
node after the Start
node gets processed.
You have now connected the Start
node to the Command
node, but haven't set the command to be executed when the Command
node is triggered.
To do this, click on the Command
node to select it. This expands a Node Configuration menu as shown below:
Here, you can select the command that you want Bixby to send. The command has to be selected from the list of capabilities supported by the device. This list of capabilities is shown as a drop-down.
Select the Switch capability. This opens up a window showing all the commands that are available in the selected capability (Switch).
Select the required command, in this case On, and click the Save button.
Great! You've now created an action flow that sends a switch on command to a light!
The editor also offers you a feature, "Try It", to test the action flow and see how it performs on a real device. You can do this without uttering any voice commands.
To try this, switch off the device, then click on the "Try It" button in the menu bar. The device will be now in a switched On state.
You can also see the green flowing line over the execution path as shown below.
Any obtained values, responses etc., are shown below the corresponding nodes.
Great! You have successfully created and tested an action flow for a voice intent!
In a similar way, you can also add action flows for more 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 add different types of nodes and make a more complex action flow.
In the next guide, you will learn how to send a device command with an argument, where you'll learn more about setting a value from the user's utterance.