Although it was born as a M2M technology, today MQTT is undoubtedly one of the most extended Internet of Things communication protocols, thanks to its integration simplicity and flexibility. That is why many commercial sensors have native MQTT integrations that can be configured to connect to a specific broker. However, MQTT only establishes a channel for communications, to create an IoT project we need other management tools, storage or data visualization, this is the role played by the IoT platforms.
Since the beginning of the project, at Thinger.io we have been really committed to the use of our own optimized protocol (which uses PSON for encoding information), using a more advanced communication model, and allowing to create more efficient infrastructures and advanced operations to manage devices (we will talk about this in another post). However, watching the extension that MQTT has reached during these years, we have understood that a lot of developers could be very benefited of Thinger.io Platform’s tools if they were able to integrate the MQTT protocol on it, so why not offer this integration too?
With this idea in our minds, we understand that thanks to the integrations that we have done with Sigfox, LoRa WAN with TheThingsNetwork, and any other HTTP device that can be integrated via REST API, we have the opportunity to link every kind of IoT devices under the same infrastructure whatever network technology they use, allowing them to work together sharing data and resources in a transparent way, which also sounds really well.
So today we are happy to announce that from now on, all instances of the Thinger.io Platform have a builtin MQTT broker to which devices can be connected very easily.
Integration of MQTT devices with Thinger.io
The process to connect a device is very simple, it is explained in detail in our documentation, however, we are going to show a brief integration example by connecting an MQTT client with the platform (using MQTT.fx), that will take only two steps: First of all, we will create a new device at Thinger.io Platform, following the same process as any other device, but in this situation we will select “MQTT” device type in the details form:
Now, we will set the Broker and device credentials in the MQTT Client, that way it will be able to create the connection with the server and start sending data. At this point, it is important to know that the MQTT protocol defines a pub-sub messaging paradigm in which devices can publish data with a specific topic, or subscribe to a topic to retrieve data from the broker. The following image shows how we have filled the necessary information in a software Client according to the example of the device “mqtt1” created before:
- Broker Address: The Thinger.io instance domain (i.e. acme.aws.thinger.io)
- Broker Port: 1883 or 8883 for SSL/TLS
- User Name: Thinger.io user account ID
- Client ID: The device identifier that was configured at the device form
- Password: Must be the same key that was placed on Thinger.io “Device Credentials” parameter
- MQTT version: Currently Thinger.io supports 3.1 or 3.1.1 versions of the protocol
Once connected the first MQTT client we can start sending data to topics. In the following image, the client has been configured to Publish data on Thinger.io MQTT broker using the topic “home/garden/fountain”, and in the same way, a second client has been subscribed to the same topic, which allows us to create a small network of data producers and consumers, perfect to make the first tests and check the performance of the broker, with which we are very satisfied.
The new Broker has been built from scratch using 3.1.1 version of MQTT and focused on providing a proper integration with Thinger.io features, once the device has been connected, the device dashboard will show the connection status, IP, geolocation and data transmission flows, and the Data Buckets on the platform can be used to store topics data if it is sent using JSON encoding. Once the data is stored in the Bucket, it is possible to represent time series and other graphics in the dashboards or apply any kind of processing rule using the Node-RED plugin, as we talked about on a previous post.
At this first release of the broker, some functionalities such as Device API or real-time widgets in Dashboards are not available yet, as well as the Endpoints are not directly functional (but can be used through Node-RED), but we will continue improving it and hopefully in future releases, it will cover all functionalities. So stay tuned for the updates.