Skip to content

MQTT String Json Format

Hi Community,

I am using the MQTT client function block of the IIoT Library from PLCnext Store and I want to publish topics to ASW cloud.

By using the example, I was able to sent the messages. The Json string was generated by the IIOT_JSON_Coder block and then pusblished by the IIOT_MqttClient_Publish block.


Is it possbile to generate the message string directly and pass it to the block? I tired it out and on the AWS side its not possible to read the message correctly. The JSON format is not send correctly.

The message string looks like:

{
  "ts": 1710320564503,
  "dc_supply": {
    "avg_voltage": 0,
    "total_current": 0,
    "units_count": 8,
    "apfc_unit_0": {
      "voltage": 0,
      "current": 0
    },
    "apfc_unit_1": {
      "voltage": 0,
      "current": 0
    },
    "apfc_unit_2": {
      "voltage": 0,
      "current": 0
    },
    "targets": {
      "voltage": 500,
      "current": 300
    }
  }
}


Thanks

Shane

Comments

Sign In or Register to comment.