Sample app to publish and subscribe to MQTT5

Refer this sample app GitHub - revant/connect_mqtt

Everything is done in this file:

makes available subscribe-mqtt and publish-mqtt bench commands


Hi @revant_one,

What is the use case here? What can we achieve via MQTT?

I believe that some MES applications use MQTT to get or set the machine values (Speed, temperature, etc) via PLC. For instance, they may stop the workstation if one of the raw material is not in the BOM. So that operator can’t start the machine until s/he scans the correct raw material barcode.

MQTT is commonly used for IoT. MQTT clients are available for constrained devices.

Another use case can be to pass messages between apps using other stacks. Why not redis pub-sub? MQTT5 has Shared Subscriptions.

The sample app just shows how to use asyncio, gmqtt, and good old bench “commands” to start a subscriber process.

The publish command is just for sample and development/testing, it should be part of code which emits messages. In fact some constrained device may actually publish the message.


Definitely. I believe that ERP is just a planning tool for the manufacturing domain. The actual part lives on the shop floor. ERPNext has a suitable “Job Card” doctype but it is not convenient to manually enter lots of data in that. So MES applications and these kinds of integrations are needed to get results.

1 Like

I didn’t understand. What is your use case? What do you want achieve?