Mqtt string payload
Hello Community,
I am using MQTT client function block to publish different values which could only be sent through string type. Is there any function block available which converts bools to string?
Is that MQTT block can send the data any other format like binary payload?
Thank you
Comments
which could only be sent through string type.
If you mean the MQTT Client FB in the IIoT Library in the PLCnext Store, then the payload does not have to be a string - it take a variable of ANY type.
Thank you Martin for your response.
The library I use is MQTT Client which is different to IIOT3. This MQTT Client library in PLCnext store.
Thank you.
Questions like this:
Is that MQTT block can send the data any other format like binary payload?
... could be sent to the developers using the "Contact" button on the product page in the PLCnext Store, since they will know the most about this function block.
For converting bools to a string, you would probably need the data source and destination to agree on the encoding format so that the destination can successfully decode the payload. One way you could encode the message is to construct a JSON string from the variable(s) you want to send. There are a few apps in the PLCnext Store that can help with encoding and decoding JSON strings.