ThingStudio MQTT message payloads now all JSON

in news

All messages in and out of ThingStudio are now JSON

Hello everyone, thanks for the way you have embraced ThingStudio and actually started making stuff. We are getting a ton of suggestions, and so far, few complaints, so we are pretty happy.

As we’ve been looking at the way forward, we’ve come to the conclusion that we need to make some changes that will be of enormous help in the future, but mean that you will need to adjust your screens and MQTT code on Things. We think that the sooner we do this the better, before both you and us have a lot of code to change.

That was the bad news, now the good news. The changes are pretty small.

Basically, we’ve have decided that the payload of all MQTT messages coming in and out of ThingStudio will be JSON in future, rather than a mix of JSON and strings which they are at the moment.

Why are we going to do that? Well, firstly it means that you can send several different variables in one MQTT message, or even arrays of variables. This can be very powerful.

As an example, suppose that you have made a sound sensor that sends back a frequency scan of 100 points. You can send back the whole set of 100 points in a single message, thus guaranteeing that the display at the ThingStudio end is showing a consistent snap shot.

So you would send:

and in your screen you could do something like

Except, of course, you would probably think of a nice graphical solution, like different height divs to make a graph out it that will update automatically.

As far as data going out of ThingStudio to your devices goes, the only difference at the moment is that you will receive values as quoted strings.

However, in the future, we intend to support HTML forms, which will allow you to send a consistent set of settings to a device for it to validate, rather than having to get values separately that may not work independently.

We will be updating docs and examples as soon as possible, and rolling out the change over the next few days.

cheers

 

Mike

I make stuff.

2 Comments

  1. gambituk

    Hi, not directly related, but the link for a tutorial for setting up mqtt broker now directs to this article.

Leave a Reply

Your email address will not be published. Required fields are marked *