Subscribe topics

MQTT subscribe topic

This function block allows the configuration of up to 10 items per topic and/or their parameters. The topics are clustered by the topic type. The data type of the corresponding topic or its parameter is defined in the parameter dialog. If the data type changes at one pin (by configuration), an already connected value is dropped if it is incompatible.

 

Defined topic types are registered. If a topic is received by the corresponding type, the content of the function block’s output is provided. For that matter, the parameter designation is compared to the designations, which have already been received. If they match, the values are converted and provided at the outputs.

Between two calls of one function block, various topics of the same type can be received. These topics are saved to a queue. Every time a function block is called, a check will be carried out, if a relevant event is present in the queue. If that is the case, this event will be evaluated. The queue will be monitored by the status function block. If the amount shown there is negative, an overrun of the queue occurred. From this time, all incoming messages are discarded, as long as the queue has no free space. At the output “New Topic”, a value > 0 is issued for one cycle, if a message is present in the queue.

Parameters

The topics can be configured over the parameter dialog (upcoming dialog when implementing the function block or over the context menu).

When entering the topic type, the following characters are allowed:

  • A-Z (no umlauts)
  • a-z (no umlauts)
  • 0-9
  • -_.

When entering the name of the item, spaces are allowed.

For both inputs, a maximum of 36 characters is allowed.

 

External: The configuration of the data type will be carried out at the pin “externally” instead of using the parameter dialog. The field “Topic” can be left blank.

QoS: refer to Quality of Service (QoS)

Parameter MQTT subscribe topic
Type not valid

Signals

Name I/O Type(s) Function
NewSubs O Word >0 – new message received in the queue
Data1 to Data 10 O Different data types Items
Status O Word Send status