Skip to content

On MQTT Message

Plugin: MQTT | Mode: Listen

Subscribe to an MQTT topic and respond to incoming messages on that topic.



The MQTT Topic that is subscribed to in order to respond to incoming messages.

Use wildcard topics (+ and #) to respond to messages in multiple (sub-)topics.

If you define a wildcard topic, the if condition allows you to specify with topic contains to which exact topic the respective condition refers.


Check incoming messages on the subscribed topic and trigger the next state if the condition matches.

In the Conditions chapter you can find out in more detail how to query incoming messages.

The value of the condition is the incoming message.


Use field to retrieve a specific value within a JSON message. You can use dot notation to specify deeper values in the JSON message.

To query the "humidity" value in the following JSON message


use the field with


Screenshot On MQTT Message action with field option

topic contains

If you have specified a wildcard topic, you can use topic contains to filter which topic should be responded to in this condition.

If the topic of the message contains the topic contains value, the condition will be reviewed. topic contains always filters the complete topic.

You can use Regular Expressions to specify the filter more precisely.

For example you can query if the topic contains a topic section only at the end. A message with topic garden/apple-tree/sensor/ph-value would be caught with the following topic contains:


Screenshot On MQTT Message action with topic contains option


Set the next state that will be triggered if none of the if conditions matched the received message or if you did not specify any if conditions.

If you did not specify an if condition, the system will switch to the next state for any message received on the specified topic or one of the topics corresponding to the wildcard.

Action data

You can access the last received MQTT message via the On MQTT Message action data variable. Use for example:


To access the most recently received message of the top On MQTT Message action in the state MyState.


The message or the part of the message that has fulfilled an if condition in the On MQTT Message action.


part of the message


Total last received message on the topic that subscribed to the On MQTT Message action.


This is not the only part of the message.


Exact topic as a single string, of the last received message, on the topic that subscribed to the On MQTT Message action.




A list of all the individual topic levels of the most recently received message on the topic to which the On MQTT Message action is subscribed.


["some", "topic"]


The part of the topic that was matched with topic contains.




Indicates whether the message has been retained, i.e. subsequently sent by the broker through the subscription.

Boolean Value (true/false)


Indicates the Quality of Service level of the message.

Can be an integer value 0, 1 or 2.


If true, the Message is a duplicate.


The message length.


Take a look at the example in the MQTT Plugin chapter.