Platform DocumentationPlatform Documentation
Device TemplateWorkflowsNodes

MQTT Publish

Publish messages to MQTT topics from your workflows.

The MQTT Publish node sends messages to an MQTT topic when the workflow runs. This is the primary way to send commands or data back to devices.

Overview

The MQTT Publish node uses the device's MQTT credentials to publish messages to any topic the device has access to.

MQTT Publish Screenshot

How It Works

  1. Configure the topic path and message payload
  2. The node publishes the message to the MQTT broker when the workflow runs
  3. Any device subscribed to that topic receives the message

Configuration

SettingDescription
TopicThe MQTT topic to publish to
PayloadThe message payload (JSON or plain text)
QoSQuality of Service level (0 or 1)
RetainWhether to retain the message on the broker

Topic Format

Use the standard MQTT topic structure:

{tenant_slug}/toDevice/{serial_number}

Using Variables in Topics

You can use workflow variables in the topic path:

mycompany/toDevice/{device.serial}

This allows dynamic topic selection based on workflow input.

Payload Examples

JSON Payload

{
  "command": "setTemperature",
  "value": 22.5,
  "timestamp": "2026-06-16T17:00:00Z"
}

Using Variables in Payload

{
  "temperature": {temperature},
  "humidity": {humidity},
  "action": "update"
}

Variables are replaced with actual values when the workflow runs.

Use Cases

  • Device commands — Send configuration changes to devices
  • Data updates — Push data back to devices
  • Control signals — Trigger actions on connected equipment
  • Status updates — Send status information to devices

Example: Temperature Control

Node: MQTT Publish
  Topic: mycompany/toDevice/SENSOR-001
  Payload: {
    "command": "setTargetTemperature",
    "value": {targetTemp}
  }
  QoS: 1

Best Practices

  • Use QoS 1 for important commands that must be delivered
  • Use QoS 0 for non-critical data where occasional loss is acceptable
  • Always validate topic paths before publishing
  • Include timestamps in messages for audit purposes

Limitations

  • The topic must be one the device certificate has permission to publish to
  • Message size is limited by MQTT broker constraints (typically 256KB)
  • Each workflow execution publishes the message once

Next Steps

Connect data nodes before MQTT Publish to prepare the message payload, or use it alongside Notification nodes for complete automation workflows.

On this page