edgexfoundry / device-modbus-go

Owner: Device WG
Apache License 2.0
78 stars 90 forks source link

Communication between modbus and MQTT from a PLC or VFD #202

Open CesarCastillo-90 opened 3 years ago

CesarCastillo-90 commented 3 years ago

Hello everyone, I hope you are well. I have managed to successfully integrate the ModbusPal emulator with EdgeX Foundry's modbus microservice. However, I have doubts about integrating any device with and seeing the results through MQTT. On the other hand, data management has been carried out from the southern border to the northern border, but I have not been able to communicate in the opposite direction. If anyone knows how to do this, I will be grateful. I look forward to your valuable comments, have a great day.

CesarCastillo-90 commented 3 years ago

ok @cloudxxx8, How can I communicate a PLC by MODBUS protocol to MQTT through EdgeX Foundry and in turn to write data from MQTT to PLC? Thank you so much!

cloudxxx8 commented 3 years ago

You could set up two App Services, one for exporting PLC data to MQTT broker, and another receiving MQTT message and send http command to Core Command service.

CesarCastillo-90 commented 3 years ago

Hi mr. @cloudxxx8, could you guide me in this?, I'm using docker compose hanoi docker-compose-hanoi-arm64.zip

weichou1229 commented 3 years ago

If you want to push data to northbound's MQTT broker, you can try something like AppServiceConfigurable's mqttsend https://docs.edgexfoundry.org/1.3/microservices/application/AppServiceConfigurable/#mqttsend

CesarCastillo-90 commented 3 years ago

Hi mr. @weichou1229, I have communication from the south border to the north via MQTT, however I do not have the opposite direction. If you can guide me in this regard, I would be grateful.

weichou1229 commented 3 years ago

You can execute read/write command via core-command service, see example https://docs.edgexfoundry.org/1.2/examples/Ch-ExamplesAddingModbusDevice/#execute-commands

CesarCastillo-90 commented 3 years ago

ok mr. @weichou1229, I go to see it, thank you so much!

weichou1229 commented 3 years ago

I don't know how to write data as a publisher to the MQTT broker to see it reflected in the ModbusPal emulator

Currently, App-Service-Configurable doesn't provide such feature, but you can create one for yourself. The introduction and example link can refer to https://github.com/edgexfoundry/app-functions-sdk-go/blob/master/README.md

CesarCastillo-90 commented 3 years ago

ok mr. @weichou1229 thank you for your help.

CesarCastillo-90 commented 3 years ago

Understood, I will do tests, if I have any concerns I will consult you again, thank you very much mr. @weichou1229.

karima-se commented 2 years ago

Hello @weichou1229 , would you like guid me to send data obtaned from ModbusPal simulator to MQTT broker please, I am using Irland version(v 2.0), I would be grateful.

karima-se commented 2 years ago

Hello @CesarCastillo-90 , I am trying to do the same thing as you but I can't send the data obtained from ModbusPal to mqtt broker, would you like give me some advice? I would be grateful.

weichou1229 commented 2 years ago

The compose-builder can setup a app service to export events to MQTT broker https://github.com/edgexfoundry/edgex-compose/tree/main/compose-builder

add-asc-mqtt-export.yml Application Service Configurable extending compose file, which adds the App Service MQTT Export service