Overview MQTT  IO


With this function block addresses can be sent and received as MQTT messages. The topic here is the address, for example "100/10/1"; the message is the value of the variable. Variable groups can be transferred by selecting the main group; the transfer is bidirectional here.

Third-party software such as IOBroker, Node-RED or Home Assistant can communicate with the runtime via MQTT clients.

A detailed step-by-step guide with examples can be found at Integration with Node-RED and Home Assistant.

Important: For this function the controller must have an image version 3.034 or higher.

See also MQTT general.


Outputs

VB
Connected
Output is 1 when connected to the MQTT broker.



Parameters

Filter main group
In this parameter the main groups of the variables are specified which are sent and received via MQTT. Several main groups can be specified separated by a semicolon ";".
Type bit variable
This parameter defines how bit variables are sent:
  • 0/1: Variables are sent as 0 or 1.
  • on/off: Variables are sent as on/off, 0=off, 1=on
  • true/false: Variables are sent as true/false, 0=false, 1=true

Server type
Internal: The MQTT broker integrated in the controller is used; no further settings are required. External: An external MQTT broker is used; specify server, port and optionally user/password and TLS.
Server
IP address of the MQTT broker. If the integrated broker on the controller is to be used, the IP address 127.0.0.1 must be specified. Domain names can also be used as the address.
Server port
Port, default is 1883.
User/password
Optional user and password if required by the MQTT broker. The internal MQTT broker on the controller uses no authentication and user/password can be left empty.
Topic prefix
Optional topic; this is prepended to the addresses. Default is "uniPRO", so with the address "1/2/3" the topic becomes "uniPRO/1/2/3". With Home Assistant auto discovery activated, the default value "uniPRO" must be kept.
Mode
Read, Write, Read/Write. This sets whether the block only receives, sends, or works bidirectionally. It is recommended to use two different blocks with different main groups for sending and receiving.
Update on start
On start of the controller all addresses of the set main groups are sent to the MQTT broker.
Update cyclically
Time in seconds. At this interval all addresses of the set main groups are sent to the MQTT broker. At 0 the addresses are not sent cyclically.
Retain
The broker stores the last message of each topic and delivers it to new subscribers immediately. Recommended so that third-party systems know all values immediately after a restart.
TLS / verify certificate
Encrypted connection to an external MQTT broker. With "verify certificate" the server certificate is checked additionally.
Home Assistant Auto Discovery With this parameter MQTT messages for the auto discovery of Home Assistant are generated for each variable. These are then displayed automatically as entities in Home Assistant. Currently only elements with "number" are supported. The topic prefix must remain at the default value "uniPRO". See also Integration with Node-RED and Home Assistant.




See also common parameters of all function blocks.