MQTT Set State Action
MQTTSetStateAction publishes messages to MQTT topics through a configured MQTT connector. Use it when Banalytics rules, manual actions, or operator workflows need to send commands, desired state, or integration messages to MQTT devices and external automation systems.
Publish Banalytics decisions to MQTT topics
The action takes a target topic, QoS, retain flag, and string message template. When executed, it publishes the UTF-8 payload through an MQTT v3 or v5 connector and waits for publish completion.
Publish command
Send device commands such as ON, OFF, open, close, or JSON control payloads.
Retained state
Use retained messages for topics that represent latest known state or desired state.
Event bridge
Attach the action to Event Manager rules to forward Banalytics events to MQTT systems.
Adding an MQTT publishing action
Select the MQTT connector
Choose an MQTT v3 or v5 connector that is connected to the broker where the message should be published.
Set a specific topic
Use stable, explicit topics such as site/gate/mode or home/light/1/set. Avoid broad shared command topics unless all subscribers expect the same payload.
Choose QoS and retain
Use QoS 1 for most commands and state changes. Enable retain only for desired-state or latest-state topics.
Enter the message template
The current implementation sends the string template as the literal UTF-8 payload.
Common MQTT publishing scenarios
Device commands
Publish simple commands to lights, relays, gates, alarm panels, PLC gateways, or other MQTT-controlled devices.
Desired state
Use retained messages for topics where new subscribers should receive the latest target state immediately.
Automation bridge
Forward Banalytics events to Node-RED, Home Assistant, cloud brokers, industrial middleware, or a local MQTTServerThing.
QoS and retain choices
Configuration parameters
| Parameter | Required | Description | Default |
|---|---|---|---|
Title | Yes | Display name of the action inside Banalytics. | None |
MQTT Connector | Yes | Reference to an MQTT connector Thing. It can be MQTTV3ConnectorThing or MQTTV5ConnectorThing. | None |
Topic | Yes | Target MQTT topic where the message will be published. | None |
QoS | Yes | Publish quality of service: 0, 1, or 2. | 1 |
Retain Message | Yes | Stores the last message on the broker so new subscribers receive it immediately. | false |
Template type | Yes | Message template type. Current documented type is STRING. | STRING |
Message Template | Yes | String content sent as the MQTT payload. | None |
Operational notes
Connector must be connected
The action fails if the selected connector is not connected when the action runs.
Publish wait time
The publish call waits up to 10 seconds for completion. Broker outages, authentication problems, TLS issues, or network timeouts can make the action fail.
Literal string payload
The current implementation sends messageTemplate as a literal UTF-8 payload. Do not expect automatic event-field substitution unless that behavior is added later.