2

I'm using ThingsBoard demo, with a throw-away test device:

  • Name: Test
  • Device ID: 779e65d0-366f-11e9-b411-fdd6fdf5c064
  • Access Token: DdqzgX0Q4QLBbveiuY8e

I set up a subscriber:

mosquitto_sub -h demo.thingsboard.io -u DdqzgX0Q4QLBbveiuY8e -t hello

Then I publish:

mosquitto_pub -h demo.thingsboard.io -u DdqzgX0Q4QLBbveiuY8e -t hello -m hi

mosquitto_pub returns 0 (success), but I see nothing shown by either mosquitto_sub or in the Test device's "Latest Telemetry".

How do I get both ThingsBoard and the subscriber to see my hi message?

1

TL;DR:

ThingsBoard expects a fixed topic of v1/devices/me/telemetry and a JSON message, eg:

mosquitto_pub -h demo.thingsboard.io -t v1/devices/me/telemetry -m '{"answer": 42}' -u DdqzgX0Q4QLBbveiuY8e

The ThingsBoard MQTT Device API Reference says:

In order to publish telemetry data to ThingsBoard server node, send PUBLISH message to the following topic:

v1/devices/me/telemetry

The simplest supported data formats are:

{"key1":"value1", "key2":"value2"}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.