MQTT Command

An MQTT command is used by the widgets in a dashboard to control devices by sending them commands over MQTT. It is the responsibility of the device to respond appropriately to the commands.

Access MQTT Commands
  1. Go to the model editor for the desired model via the Models page.
  2. Click the section in the section selector.
Adding and Editing Commands

To add a command:

  1. Click the button in the top left.
  2. Specify the name of the command.
    • This is what is used when searching for commands in the widget settings on a dashboard.
  3. Specify the topic of the command.
    • This is the actual MQTT topic sent to the device.

Edit a command by pressing its button.

Using Commands in Dashboards

See here for more info on setting up widgets in dashboards.

  1. Open the dashboard settings by clicking the button in the top right.
  2. Click the button on any pane.
  3. Select a widget to add.
    • Any widget under the Control section of the dialog for adding widgets, and some custom widgets, can send commands.
  4. Select a datasource for the calculated setting.
  5. Search for the desired command by name or find it in the list of signals and commands (commands are above the signals).
  6. Add the widget.

Commands can be sent to devices with custom payloads. Some built-in widgets send preset payloads, like the Two-Action Control widget:

// Sent when the left button is clicked "{\"button_1\":1, \"button_2\":0}" // Sent when the right button is clicked "{\"button_1\":0, \"button_2\":1}"

This payload has been stringified. However, custom widgets can be developed to send whatever command payload is needed.

Models for devices that connect to the Spoke Zone MQTT broker must use the ctrl/ prefix for all commands. See here for more information.