send_devkit_mqtt_action method by targeting the device’s MQTT topic.
You can also register your devices in the dashboard. Registered devices are exposed to an Ability through self.worker.mqtt_devices, letting it discover the available devices at runtime — useful for voice Abilities that adapt to whatever devices a user has set up.
MQTT device control requires an OpenHome DevKit. It cannot run from web Agents.
New to MQTT?
MQTT is a lightweight publish/subscribe messaging protocol used widely by IoT and smart-home devices: a device subscribes to a topic, and commands are sent by publishing to that topic. This page assumes familiarity with that basic model. For a deeper introduction to the protocol itself, see:- MQTT.org — the official protocol site
- HiveMQ MQTT Essentials — an introductory guide
Sending Actions with send_devkit_mqtt_action
send_devkit_mqtt_action is a CapabilityWorker method, called from an Ability’s main.py. It instructs the DevKit to publish an MQTT command to a device on its broker.
None immediately and does not wait for the device to respond.
A
None return value is expected, not an error. Confirm an action succeeded by observing the device, not by inspecting the return value.You don’t need to register a device to control it. As long as the device is connected to your DevKit’s broker, you can target it directly by its topic. Registering a device only makes it discoverable through
self.worker.mqtt_devices — see Registering Devices.Parameters
| Parameter | Type | Description |
|---|---|---|
topic | str | MQTT topic of the target device. |
action | str | The operation to perform: turn_on, turn_off, or custom. |
value | str | Payload for a custom command. Ignored for turn_on and turn_off. |
command | str | The device-specific command for a custom action. Ignored for turn_on and turn_off. |
Actions
action | Description | Parameters used |
|---|---|---|
turn_on | Powers the device on. | topic |
turn_off | Powers the device off. | topic |
custom | Sends a device-specific command. | topic, command, value |
turn_on and turn_off require only topic; the command and value arguments are ignored. Use custom for any other operation — such as brightness, color, temperature, or device modes — supplying the command and payload that the device expects.
Examples
Power a device on and off:custom:
The
command and value for a custom action are specific to the target device. Record the commands a device supports when you register it, so an Ability has a reliable reference for what it can send. See Registering Devices.Default MQTT Configuration
The DevKit’s MQTT broker is preconfigured and ready to use. To view or update it, open the dashboard and go to OpenHome DevKit → MQTT. This section shows the DevKit IP along with the broker’s username, password, and port (the default port is1883).
To change the broker’s username and password, use the Update MQTT button in this section. The DevKit applies the new credentials to its broker.

Connecting a Device to the Broker
A physical MQTT device must connect to the DevKit’s broker before it can be controlled. In that device’s own MQTT connection settings, enter the values shown in the MQTT section:| Device setting | Value |
|---|---|
| Host / Broker address | The DevKit IP shown in the MQTT section. |
| Port | The port shown in the MQTT section (default 1883). |
| Username | The username shown in the MQTT section. |
| Password | The password shown in the MQTT section. |
Every device must connect to the same broker — the one running on your DevKit. Use the DevKit IP from the MQTT section as the broker host on each device.
Registering Devices
Registering a device makes it known to the DevKit and available to an Ability. Add a device from the OpenHome DevKit → MQTT section with the following fields:| Field | Description |
|---|---|
| Name | A friendly name for the device, such as Living Room Light. |
| Topic | The device’s MQTT topic. This is the value passed as topic to send_devkit_mqtt_action. |
| Command | The list of commands the device supports. When an Ability uses the LLM to decide what to send, this list is the LLM’s reference — the clearer and more complete it is, the better the LLM can pick the right command and value for a request. |
| Description | A short description of the device, such as its room or type. The LLM uses this to identify the device and tell it apart from others, so keep it specific. |
self.worker.mqtt_devices — a list the Ability reads to discover its devices and decide which one to control. The Command and Description you enter here travel with each device in that list, so writing them clearly directly improves how well an LLM-driven Ability picks the right device and command. The next section covers how an Ability reads and uses this list.
Accessing Registered Devices with self.worker.mqtt_devices
Within an Ability, the registered devices are available as self.worker.mqtt_devices — a list of dictionaries, one per device:
topic:
mqtt_devices list to the LLM, allowing it to map a spoken request to the correct device — using each device’s commands and description to determine the topic, action, and, for a custom action, the command and value. The example below follows this pattern.
Example: A Smart Home Ability
This Ability reads the registered devices fromself.worker.mqtt_devices, sends the request and the device list to the LLM, and publishes the action the LLM returns with send_devkit_mqtt_action. Because the LLM acts as the orchestrator, the same code handles any registered device — to support a new device, register it in the dashboard; no code changes are required.
Suppose a device like this is registered in the dashboard:
| Field | Value |
|---|---|
| Name | Bedroom Light |
| Topic | tasmota_channel |
| Command | /HSBColor hue,sat,bri (0-360,0-100,0-100); /Dimmer 0-100; /CT 153-500 (warm→cool); /Color R,G,B 0-255 |
| Description | RGBCW smart bulb — full RGB color plus tunable warm-to-cool white, dimmable. Controlled over MQTT (Tasmota). |
self.worker.mqtt_devices and passes it to the LLM, which uses the device’s command list and description to map a request like “make the bedroom light blue” to topic="tasmota_channel", action="custom", command="/HSBColor", and value="240,100,100".
Interaction Flow
Capture the request
main.py waits for the user’s full request with wait_for_complete_transcription().Load registered devices
The Ability reads
self.worker.mqtt_devices. If no devices are registered, it asks the user to add them in the OpenHome DevKit → MQTT section and exits.Decide the action
format_devices() renders the device list into the prompt, and the LLM returns a single JSON action — a topic and action (plus command and value for custom) with a spoken reply, or an ask when it needs clarification.Clarify if needed
If the LLM returns
ask, the Ability poses the question with run_io_loop() and decides once more with the added detail.Publish the action
The Ability calls
send_devkit_mqtt_action() with the resolved topic, action, command, and value. The DevKit publishes the command to the device.Best practices
Give each device a clear command list
Give each device a clear command list
The
Command field you set when registering a device is the reference an Ability and the LLM rely on. List the commands the device actually supports so requests map to valid commands.Use custom for anything beyond power
Use custom for anything beyond power
Only
turn_on and turn_off ignore command and value. For brightness, color, temperature, or device modes, use action="custom" with the device-specific command and payload.Point every device at the DevKit broker
Point every device at the DevKit broker
A device is only controllable once it connects to the DevKit’s broker. Configure each device with the DevKit IP, port, and credentials from the MQTT section.
Confirm by observation, not by return value
Confirm by observation, not by return value
send_devkit_mqtt_action is fire-and-forget and returns None. Confirm the result by the device’s behaviour, and speak a short confirmation to the user.Handle the empty-device case
Handle the empty-device case
When
self.worker.mqtt_devices is empty, guide the user to register devices in the MQTT section rather than failing silently.See also
- Local Abilities — run code on the DevKit for direct, low-level device control
- Home Assistant — install Home Assistant on the DevKit and control devices by voice
- How to Build an Ability — the fundamentals of building an Ability
- SDK Reference — the full CapabilityWorker method catalog

