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.
- Go to the model editor for the desired model via the Models page.
- Click the
section in the section selector.
To add a command:
- Click the
button in the top left. - Specify the name of the command.
- This is what is used when searching for commands in the widget settings on a dashboard.
- Specify the topic of the command.
- This is the actual MQTT topic sent to the device.
Edit a command by pressing its
See here for more info on setting up widgets in dashboards.
- Open the dashboard settings by clicking the
button in the top right. - Click the
button on any pane. - Select a widget to add.
- Any widget under the Control section of the dialog for adding widgets, and some custom widgets, can send commands.
- Select a datasource for the
calculated
setting. - Search for the desired command by name or find it in the list of signals and commands (commands are above the signals).
- 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:
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.