thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
219 stars 54 forks source link

Thin Edge Cumulocity Modbus Plugin #1482

Closed rina23q closed 1 year ago

rina23q commented 1 year ago

Is your feature request related to a problem? Please describe. Modbus TCP/RTU support with thin-edge.io will give an opportunity for the existing users that use Modbus to replace Cumulocity Linux Agent by thin-edge.io.

This is the Modbus feature in the device management in Cumulocity. Screenshot from 2022-10-12 15-45-35

The key functions that Linux Agent's Modbus plugin supports:

  1. The device where the agent installed acts as Modbus master
  2. User can add slave(s) dynamically via Cumulocity UI. Note: The operation to remove slave(s) does not exist in Cumulocity.
  3. User can configure "Baud rate", "Parity", "Date bits", and "Stop bits" for RTU via Cumulocity UI.
  4. User can configure "Transmit rate" (the interval when the agent sends data to Cumulocity), and "Polling rate" (the interval when the agent "Master" gets data from "Slaves").
  5. The agent understands the "Device protocols" of Cumulocity which the agent receives on the startup of process, and the agent converts the data from slaves accordingly. Then, sends these data to Cumulocity.
  6. Read/Write is possible by "Fieldbus Device Widget". See below.

Describe the solution you'd like In short, support all those features described above. As the prototype, I would suggest to focus on:

  1. It is a plugin like c8y_configuration_plugin and c8y_log_plugin.
  2. Use only MQTT as communication protocol to interact with Cumulocity. Since all Modbus operations are not implemented as static SmartREST template, a custom template is necessary.
  3. First focus on TCP as a slave is easier to simulate. Later consider RTU.

Describe alternatives you've considered We can start with a prototype implementation written in any language. My proposal is Python as it has libmodbus.

Additional context

mbay-ODW commented 1 year ago

We started working on that in a draft https://github.com/thin-edge/modbus-plugin

reubenmiller commented 1 year ago

The modus plugin repository has been made public now. https://github.com/thin-edge/modbus-plugin