Two-way communication using MQTT on Thinger.io

Hello Thinger.io Community,

I recently subscribed to Thinger.io to explore MQTT for device communication. I aim to build a dashboard that allows me to modify specific variables on an Arduino device to control relays. I believe I need to set up ‘shared variables’ between the dashboard and the device for this purpose. Could you please review my proposed setup and confirm if it’s correct, or suggest improvements?

Here’s how I plan to configure it:

  1. Under the “Properties” tab in “Products,” I create ‘shared variables’ as device properties.
  2. These properties can then be linked to the dashboard, allowing for manipulation.
  3. In “API Resources” within “Products,” I’ll add a new resource. In new resource, the request is set to a “Device Topic” that the device subscribes to, and the response is configured as a “Device Property” linked to the aforementioned device properties.

Is this setup correct and the simplest way to achieve my goal? If so, how should I configure the Payload in the API Resources for the request?

Thank you for your assistance!

I’ve successfully created a dashboard that allows me to control the device using MQTT. I followed the example provided here.

Everything works smoothly when I send a single variable to one topic. However, I’m facing an issue when I try to send multiple variables using a single JSON payload to a single topic. In this case, I can’t set a widget resource, like a slider, to a specific variable from the JSON. For example, I send:

{
  "VarA": true,
  "VarB": 1000
}

which is received under product property called sharedVars.

Then in Slider widget I can choose sharedVars only:

How can I enable “VarA” and “VarB” to be accessible as resources?

I successfully displayed variables by modifying the widget in the developer settings and using variable mapping.