Cloud / MQTT

fischertechnik Cloud

Blocks for communication with the fischertechnik Cloud.

These blocks are used for "Sensorstation IoT" and "Training Factory Industry 4.0".

MQTT Client

MQTT stands for "Message Queuing Telemetry Transport" protocol and is often used in IoT (Internet of Things) applications.

MQTT client create: websockets

Bild6.png

Creates an MQTT client with which messages can be received and sent. It is recommended to write the output of the block into a variable in order to be able to use the client several times later in other blocks.

MQTT client ... connect

Bild7.png

Connects an MQTT client to an MQTT broker with the specified settings. Client can be the block "MQTT client create" or its output in a variable. Host specifies the address of the MQTT broker. To use the local MQTT broker, localhost or 127.0.0.1 is entered as the value. To use external MQTT brokers, their IP address or host name must be used. Port specifies the port on which the MQTT Broker is available. The default is 1883 for MQTT Broker (fischertechnik Cloud) or 2883 (GUI application). If external MQTT brokers are used, their port must be entered. Username and password are empty by default; for external servers, their login information must be entered here.

MQTT client ... is connected

Bild8.png

MQTT client can be the block "MQTT client create" or its output in a variable. Returns "true" if the specified MQTT client is connected to an MQTT broker. If the MQTT client is not connected, "false" is returned.

MQTT client ... disconnect

Bild9.png

MQTT client can be the block "MQTT client create" or its output in a variable. Disconnects the specified MQTT client from the MQTT broker.

MQTT client ... publish

Bild10.png

MQTT client can be the block "MQTT client create" or its output in a variable. Publishes a message "payload" with the specified MQTT client in a specified channel "topic". In addition, "qos" and "retain" can be specified, i.e. whether newly connected clients should receive the message after sending and with which security level the message should be sent.

MQTT client ... publish (with return value)

Bild11.png

MQTT client can be the block "MQTT client create" or its output in a variable. Publishes a message "payload" with the specified MQTT client in a specified channel "topic". In addition, "qos" and "retain" can be specified, i.e. whether newly connected clients should receive the message after sending and with which security level the message should be sent. If the message is sent successfully, "true" is returned, otherwise "false".

MQTT client ... will set

Bild12.png

MQTT client can be the block "MQTT client create" or its output in a variable. Sets the message "payload", which is to be sent after disconnecting the MQTT client in a specified channel "topic", and with which security level the message is to be sent.

MQTT client ... subscribe

Bild13.png

Subscribes to a channel with an MQTT client. The function to be executed when receiving a message is specified in the callback argument. "Qos" specifies the security level with which the message is to be sent.

subscribe callback ... : message

Bild14.png

Defines a function that is to be executed by receiving a message. Message contains the received message.

 

 


Revision #2
Created 9 January 2023 10:45:57 by Alexander Steiger
Updated 9 January 2023 11:00:06 by Alexander Steiger