MQTT_Connect block

Short summary

Name

MQTT_Connect

→POU type

→function

Category

more system blocks, MQTT

Graphical interface

Available since

  • version 1.28.0 (for Neuron Power Engineer) and version 2.3.1301 of the →runtime system – initial variant

  • version 1.108.0 (for Neuron Power Engineer) and version 3.18.0 of the →runtime system – enhancement: data type STRING for existing inputs address, clientId (instead of STRING[255]); new inputs username, password, useSSL; data type MQTT_RC for output rc (instead of DINT)

(warning) This block is supported for →Raspberry Pi

Functionality

The block connects a controller to the →MQTT broker the address of which is specified at input address. An arbitrary client ID can be supplied to the connection.

(info) The data is transferred by means of an already existing MQTT broker (see "Preparing/Realizing data transfer via MQTT").

Inputs, outputs, return value

 

Identifier

→Data type

Description

Inputs:

address

STRING

address of the MQTT broker (tcp://<ip>:<port>)

clientId

STRING

client ID of this connection
Each connection needs to have an identifier that is unique for all connections to the MQTT broker. 

username

STRING

username for this connection to the MQTT broker

password

STRING

password for this connection to the MQTT broker

useSSL

BOOL

currently not supported: whether to use (TRUE) or not to use (FALSE) SSL encryption

Outputs:

rc

MQTT_RC

return code of involved MQTT functions as specified in data type MQTT_RC

Return value:

DINT

returns the connection handler of the newly created MQTT connection

Input EN and output ENO are available when →calling the block. See "Execution control: EN, ENO" for information on input EN and output ENO.

See:

Example for usage within ST-editor

See "MQTT_Disconnect block".

When creating your application within the ST-editor, enter a call of a block by typing the text as requested by the syntax or use Content Assist.