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 CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by