MQTT Subscribe
R2026bLibraries:
STM32 Microcontroller Blockset /
STM32F4xx Based Boards
STM32 Microcontroller Blockset /
STM32F7xx Based Boards
STM32 Microcontroller Blockset /
STM32H7xx Based Boards
Description
The MQTT Subscribe block receives messages from the MQ Telemetry Transport (MQTT) broker for the specified topic.
At each time step, the block checks if a new message is available on the specified topic. If a new message is available, the block receives the message. The Message port outputs the new message. If a new message is not available, Message outputs the last received message. The Topic port outputs the topic of the received message. The string topic/level/# on the block icon is specified by the Topic parameter.
For more information on MQTT, see Introduction to MQTT.
Note
The MQTT Subscribe block supports MQTT only over TCP/IP sockets.
Examples
Limitations
Only a maximum of 10 MQTT Subscribe blocks are allowed in a Simulink® model.
Ports
Output
Parameters
Programmatic Use: Add Block
To add the block programmatically, use the add_block function with one of these library block paths as the source.
"stm32f4xxblockslib/MQTT Subscribe"
"stm32f7xxblockslib/MQTT Subscribe"
"stm32h7xxblockslib/MQTT Subscribe"
Example: add_block("stm32f4xxblockslib/MQTT Subscribe","myModel/myBlock",MakeNameUnique="on")
Version History
Introduced in R2024a


