MQTT Topics

The following topics are used for read/write interaction between client and neuron.

The client-id in all topics refers to the actual MQTT client id, which is set in the northbound application configuration in the Neuron UI.

Read Tags

Request

Topic neuron/{client-id}/read/req

Body

  1. {
  2. "uuid": "E21AEE51-1269-B228-E9E5-CD252CE10877",
  3. "node_name": "modbus-tcp-1",
  4. "group_name": "group-2"
  5. }

Response

Topic neuron/{client-id}/read/resp

Body

  1. {
  2. "uuid": "E21AEE51-1269-B228-E9E5-CD252CE10877",
  3. "tags": [
  4. {
  5. "value": 4,
  6. "name": "data1",
  7. },
  8. {
  9. "name": "data2",
  10. "error": 2014
  11. }
  12. ]
  13. }

Note The value is displayed only when the value is read correctly , when the value is read incorrectly, the error code is displayed, not the value.

Upload Data

Response

Topic neuron/{client-id}/upload

Body (Tags format)

  1. {
  2. "node_name": "modbus-tcp-2",
  3. "group_name": "group-1",
  4. "timestamp": 1647497389075,
  5. "tags": [
  6. {
  7. "value": 123,
  8. "name": "data1",
  9. },
  10. {
  11. "name": "data2",
  12. "error": 2014
  13. }
  14. ]
  15. }

Body (Values format)

  1. {
  2. "node_name": "opcua-1",
  3. "group_name": "group-1",
  4. "timestamp": 1650006388943,
  5. "values":
  6. {
  7. "cstr01": "hello!"
  8. },
  9. "errors":
  10. {
  11. "cstr100": 10002
  12. }
  13. }

Note The value is displayed only when the value is read correctly, when the value is read incorrectly, the error code is displayed, not the value.

There are two message formats for the body. You can choose one of two different formats in the mqtt configuration form.

Node: A group sends a message.

Write Tag

Request

Topic neuron/{client-id}/write/req

Body

  1. {
  2. "uuid": "E21AEE51-1269-B228-E9E5-CD252CE10877",
  3. "node_name": "modbus-tcp-1",
  4. "group_name": "group-2",
  5. "tag_name": "tag1",
  6. "value": 1234
  7. }

Response

Topic neuron/{client-id}/write/resp

Body

  1. {
  2. "uuid": "E21AEE51-1269-B228-E9E5-CD252CE10877",
  3. "error": 0
  4. }