MQTT Publish to TAGO.io

2 次查看(过去 30 天)
Rodrigo Botelho
Rodrigo Botelho 2021-4-1
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

回答(1 个)

Rodrigo Botelho
Rodrigo Botelho 2021-4-6
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.

类别

Help CenterFile Exchange 中查找有关 Block Libraries 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by