MQTT Publish to TAGO.io

5 views (last 30 days)
Rodrigo Botelho
Rodrigo Botelho on 1 Apr 2021
Answered: Rodrigo Botelho on 6 Apr 2021
Hi,
I'm trying to publish to Tago using RaspberryPi MQTT Publish block, but I haven't had any success, yet. I'm getting status -1 from the block.
I set the mqtt details in Target hardware resources as:
mqtt.tago.io
Username: Any value
Password: my device token
Client ID: Any value
MQTT Publish Block:
topic: tago/data/post
TAGO expects a json string vector. I tried to convert a string vector to ASCII, but it didn't work. Any idea on how to solve it?
Thanks

Answers (1)

Rodrigo Botelho
Rodrigo Botelho on 6 Apr 2021
I have figured out one way of solving it.
Since the MQTT Publish block does not support Strings, it's possible to send raw data to Tago.io platform and use the Payload Parser to format the data being received.
In Simulink, one should add the String to ASCII block before the Publish.
On Tago.io parser, one should write a small script in JS getting the data from a raw payload and comnverting to desired data type. Then it will be trivial to find the new variable for plotting.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!