MQTT Broker integration using REST API

MQTT Broker integration using REST API

In today’s world, the enterprise application system is incomplete without providing a way to integrate with other systems. Ergo,MQTT Broker integration with your application is very crucial for any process / production management application in Industrial and Customer implementation. To make such implementation feasible, MQTTRoute supports many integrations which include Relational DB, Data storage, Queue integration, Application integration, Social integration & finally Application/Mobile integration using REST APIs. Bevywise MQTT broker was built with options to store data into any back end data storage via the custom data store. You can visualize the data by storing the data into the storage. In addition, You can use the ready to use plugin to store data to Elastic and MongoDB. In addition to this, our recent update on MQTT Broker comes up with an extension to store the data in any of the big data engine for powerful analysis & Data hooks for any custom integration.

We are still working hard to make the MQTT Broker work more seamlessly with any of your application. Hence, we support the availability of APIs in our MQTT Broker with some additional interactions through which your IoT Application can manage your edge devices via the MQTT Broker.

Need of REST API Integration

In the digital world, the huge number of cloud / mobile applications & IoT devices keep on rising and hence the businesses are trying to find a beneficial use for these emerging sources. Any how, the biggest challenge lies in integrating these applications with other business operation systems to bring together into a unified whole which can be easily shared within one’s businesses. This is where REST APIs comes in, which permits the interaction between applications & servers to boost the product functional capability & getting data where & when they need it, creating an overall well-connected eco-system.

For example, in order to manage & control business / enterprise assets some organizations make a choice of cloud-based systems. Earlier, Business measures which have been stored within an existing organization are now locked behind such a third-party applications and web interfaces. Business’s need this information to make data-driven decisions, and APIs make that possible. APIs will break down the data access by defining the interactive commands for the application systems. Furthermore, APIs can also be used in the third-party integration tools to call for the data. They can be integrated with other application systems to process business inquiries.

MQTT Broker integration with REST API:

While building an IoT application, there is a need to control and manage the edge devices from the manager application. REST API will help you control your edge devices via the MQTT Broker. It allows you to query MQTT clients, sessions, send messages, add new authentication keys. You can also query and monitor the connected devices.

We have carefully selected the most useful communication that is needed between any application and its broker to provide you the best management experience/functionality. The following are the list of interactions available now

  1. Send a message to any specific device.
  2. Send a message to all devices based on a subscription.
  3. Add a MQTT Device Authentication username and password dynamically from your application.
  4. Remove a MQTT Device Authentication String from the MQTT Broker
  5. Get the list of active devices connected right now to the MQTT Broker.
  6. Get the count of clients connected

For more details on the API, refer to the  MQTT Broker API page 

One of our customers, FAB Controls is an IoT solution provider in the United Kingdom who provides IoT solutions to the lighting and energy industries. EmMonIT is their elite solution for emergency lighting control. Their emergency lighting control device is efficacious in monitoring lighting steadily to set the seal on operating successfully. MQTTRoute plays an indispensable role in their emergency monitoring solution. MQTTRoute acts a central broker and therefore it collects data from lighting control devices and pushes it to Google pubsub to create simple and real-time visualization of data. Besides this, as MQTTRoute supports REST APIs, the lightning control devices can be controlled & monitored from the manager application. This provides a virtual foolproof emergency lighting by enabling them to constantly check the status of emergency lighting anywhere at anytime.

Unsolicited Messages:

MQTT Broker now supports sending of Unsolicited messages to the Edge Device. Yes, you read it right. You can now send messages to any specific device for a topic for which the client is not already subscribed to. This is an enhancement to support device development platforms like Telit.  Send the http call to /clientsend with the target device, topic provided by the device for receiving unsolicited messages, message, QoS and Retain as required.

We have also added an advanced custom implementation inside the /lib folder of the product to send the data received into your Python class file to process it in a better way.

Try the fastest MQTT Broker now.

MQTT Broker Tableau Integration for IoT Data Analysis

MQTT Broker Tableau Integration for IoT Data Analysis

MQTT Broker is a perfect middleware and fastest broker to be used for collecting data from your IoT edge devices and store and analyse it the way you needed.  Tableau is a cool BI tool that will help you analyse the data in all dimensions.  MQTT Broker Tableau integration will help you store all your data in the format you needed into the Tableau for a perfect data analysis. This blog helps you visualize data of MQTT Broker with Tableau by connecting it to MySQL or MongoDB.

MQTT Broker Tableau Integration using MySQL

 Changes to be done in MQTT Broker: 

  1. Open the Conf folder(Bevywise/MQTTRoute/conf)
  2. Change the DB Server to MySQL
  3. Give the MySQL Password in “MySQL Password =”
  4. Save the File
  5. Check that the MySQL is running on 3306 Port.
  6. Start the MQTT Broker using sh runbroker.sh inside the bin/ folder.
  7. Next you need to connect the client and verify the  creation of “bevywise” DB in MySQL.

To Verify the DB is Created or not in MySQL:

  1. Login to MySQL by the command “mysql -u<username> -p<password>”
  2. Next type “show databases;” command to view the created DB.
  3. In Output, you can see “bevywise” db is created.

Connect Tableau via MySQL ODBC Connector :

Tableau will use MySQL ODBC connector driver to talk to the MySQL. You might already have the required driver installed on your computer. If the driver is not available in your computer, Tableau displays a message in the connection dialog box with a link to the Driver Download page where you can find driver links and installation instructions. Click the “Data Source” drop down box and Select “MySQL”. Next choose OS & Bit Version and Install the driver.

Make the connection and set up the Tableau:

1.Start Tableau and under Connect, select MySQL. Then do the following:

  • Enter the name of the server that hosts the database.(Give “localhost” if MySQL is running in the same machine)
  • Enter the user name and password.
  • Select Sign In.

2. On the data source page, do the following:

  • From the Database drop-down list, select a database or use the text box to search for a database by name.
  • Under Table, select a table or use the text box to search for a table by name.
  • Drag the table to the canvas, and then select the sheet tab to start your analysis.

MQTT Broker Tableau Integration via MongoDB

Configuring MQTT Broker:

  1. Please download and install MongoDB Plugin for Bevywise MQTT Broker.
  2. Follo the steps in Readme.md file to configure and setup the MongoDB Plugin.
  3. Next Restart the MQTT broker and Connect the device.

To Verify the DB is Created or not in MongoDB:

  1. Login to Mongo DB by the command “mongo –port 27017”
  2. Next type “show dbs” command to view the Created DB.
  3. In Output, you can see “bevywise” db is created

Connecting Tableau via MySQL ODBC Connector :

Tableau use MongoDB Bi connector driver to talk to the MongoDB. You might already have the required driver installed on your computer. If the driver is not installed on your computer, Tableau displays a message in the connection dialog box with a link to the Driver Download page where you can find driver links and installation instructions. Click the “Data Source” drop down box and Select “MongoDB Bi Connector”. Next choose OS & Bit Version and Download the driver.

Creating Authentication for Mongo DB:

Login to the MongoDB shell by the command “mongo –port 27017

Next use the “bevywise” database by the command ” use bevywise
Type the below query to create a username and password for the DB

db.createUser(

{

  user: “<Username>”,

  pwd: “<Password>”,

roles: [ { role: “userAdminAnyDatabase”, db: “bevywise” } ]

  }

)

Re-start and login to the MongoDB by the command

mongo –port 27017 -u “myUserAdmin” -p “abc123” –authenticationDatabase “bevywise”

For more reference refer the Enable Auth link

Installation and Setup of MongoDB Bi connector in windows:

  1. To install the Mongo DB Bi connector, Double click the downloaded .msi Connector file and Install it.
  2. Next you need to check the installation of connector inside the MongoDB folder which is inside the program files.
  3. Follow the link to setup the MongoDB BI Connector.
  4. After Installation, don’t exit from the terminal.

Make the connection and set up the Tableau:

1.Start Tableau and under Connect, select MongoDB BI Connector. For a complete list of data connections, select More under To a Server. Then do the following:

  • Enter the name of the server as “localhost”.
  • Enter your user name with associated database name, and password.
  • Select Sign In.
  • If Tableau can’t make the connection, verify that your credentials are correct. If you still can’t connect, your computer is having trouble locating the server. Contact your network administrator or database administrator.

2. On the data source page, do the following:

  • (Optional) Select the default data source name at the top of the page, and then enter a unique data source name for use in Tableau. For example, use a data source naming convention that helps other users of the data source figure out which data source to connect to.
  • Select the sheet tab to start your analysis.

Download the MQTT Broker now to get started with the MQTT Broker Tableau integration.

download now
Feel free to contact support for any questions or help.