Sending a Device Command with an Argument

This guide assumes familiarity with:

In this guide, you'll learn how to send a command to the device with an argument. You'll also be introduced to the Utterance Parameter Node.

Let's take the example "Set the brightness of the Bulb to {value}" to create a command for setting the brightness of the bulb. The goal is to define the action flow for this voice intent.

Utterance Parameter Node

For this intent, the user must give Bixby an integer between 0 and 100:

"Set the brightness of the Bulb to 50"

This parameter value is passed down to a special node called the Utterance Parameter node.

To add an Utterance Parameter node, drag the node from the Node menu to the flow editor area. Then, select the dragged node if not already selected. This will show the Node Configuration menu at the right side of the flow editor area. Select an integer to indicate that this is an integer parameter.

You can click "Try It" to test our action flow, but there is no real utterance spoken. How can you specify a value to test the utterance parameter? Enter a value in the defaultValue field of the Node Configuration:

Configuring the Node defaultValue

Command with an Argument

Now that you have the value, send a command to the device to set the brightness of the bulb to the value you previously assigned.

Use a Command node for this. Set it to the switchLevel command:

Setting the switchLevel Command

After setting up the Command node, input ports for the setLevel() command can be seen: level and rate.

Setting Input Ports for setLevel() command

Since rate is an optional argument, ignore it to keep things simple. The level input determines the value of brightness for this device.

The Configured Command Node

Now you need to connect a data path from the Utterance Parameter node's value data port to the Command node's level data port. You also need to connect the Start node to the Command node with an execution path.

The action flow looks as shown below:

The Finished Action Flow

Test With Try It

When you test the action flow using the Try It button, the flow editor looks like this:

Action Flow Showing Execution Path

The value of the Utterance Parameter node has been set to 50, and this is used as the mock utterance value. That value, 50, is then used to set the value of brightness for the voice command "set the brightness of the bulb to 50".