MQTT Publish to TAGO.io

1 回表示 (過去 30 日間)
Rodrigo Botelho
Rodrigo Botelho 2021 年 4 月 1 日
回答済み: Rodrigo Botelho 2021 年 4 月 6 日
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 Center および File ExchangeSimulink Environment Customization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by