Skip to content

MQTT Writer

Class: MQTTWriterSinkBlockV1

Source: inference.enterprise.workflows.enterprise_blocks.sinks.mqtt_writer.v1.MQTTWriterSinkBlockV1

MQTT Writer block for publishing messages to an MQTT broker.

This block is blocking on connect and publish operations.

Outputs: - error_status (bool): Indicates if an error occurred during the MQTT publishing process. True if there was an error, False if successful. - message (str): Status message describing the result of the operation. Contains error details if error_status is True, or success confirmation if error_status is False.

Type identifier

Use the following identifier in step "type" field: mqtt_writer_sink@v1to add the block as as step in your workflow.

Properties

Name Type Description Refs
name str Enter a unique identifier for this step..
host str Host of the MQTT broker..
port int Port of the MQTT broker..
topic str MQTT topic to publish the message to..
message str Message to be published..
qos int Quality of Service level for the message..
retain bool Whether the message should be retained by the broker..
timeout float Timeout for connecting to the MQTT broker and for sending MQTT messages..
username str Username for MQTT broker authentication..
password str Password for MQTT broker authentication..

The Refs column marks possibility to parametrise the property with dynamic values available in workflow runtime. See Bindings for more info.

Available Connections

Compatible Blocks

Check what blocks you can connect to MQTT Writer in version v1.

Input and Output Bindings

The available connections depend on its binding kinds. Check what binding kinds MQTT Writer in version v1 has.

Bindings
  • input

    • host (string): Host of the MQTT broker..
    • port (integer): Port of the MQTT broker..
    • topic (string): MQTT topic to publish the message to..
    • message (string): Message to be published..
    • qos (integer): Quality of Service level for the message..
    • retain (boolean): Whether the message should be retained by the broker..
    • timeout (float): Timeout for connecting to the MQTT broker and for sending MQTT messages..
    • username (string): Username for MQTT broker authentication..
    • password (string): Password for MQTT broker authentication..
  • output

    • error_status (boolean): Boolean flag.
    • message (string): String value.
Example JSON definition of step MQTT Writer in version v1
{
    "name": "<your_step_name_here>",
    "type": "mqtt_writer_sink@v1",
    "host": "localhost",
    "port": 1883,
    "topic": "sensors/temperature",
    "message": "Hello, MQTT!",
    "qos": 0,
    "retain": true,
    "timeout": 0.5,
    "username": "$inputs.mqtt_username",
    "password": "$inputs.mqtt_password"
}