Refer this sample app GitHub - revant/connect_mqtt
Everything is done in this file:
https://github.com/revant/connect_mqtt/blob/main/connect_mqtt/commands/__init__.py
makes available subscribe-mqtt
and publish-mqtt
bench commands
Refer this sample app GitHub - revant/connect_mqtt
Everything is done in this file:
https://github.com/revant/connect_mqtt/blob/main/connect_mqtt/commands/__init__.py
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.
I didn’t understand. What is your use case? What do you want achieve?
Hi sir,
so is it possible to connect my frappe to mqtt and connecrt to my devices with this repo?
This is reference code that shows example command to subscribe to message(s).
You will need to run it as part of your supervisor processes or containers so it can watch for the messages. Change it to watch and respond as per your need.
In case of publish command, it can be called as part of your python api to publish messages to broker.
Copy-paste as-is will not work.
Hi
does frappe offers mqtt broker features? where exactly does this code goes?