Node Red MQTT Broker Integration

Node Red MQTT Broker Integration

Creating and implementing a real-time IoT network with hardware and MQTT application will take time and cost you an arm and leg. We at Bevywise, create a smart and easy way to set up a virtual IoT network with  node red  MQTT Broker integration.  Node-red is an open source visual programming tool for wiring the hardware with MQTT protocol support and Bevywise MQTT Broker is a highly scalable middleware which automate all IoT network with many customized features. Below steps help for  node red  MQTT Broker integration.

Node red setup

Node-red depends on node.js and npm to install Node software package. So, you should install node.js and npm in your PC. Below steps help you to install node.js and npm

Node.js and npm installation:

In Ubuntu:

Open terminal and install the below packages to install node.js and npm

  • Command to install node.js

sudo apt-get install nodejs-legacy

  • Command to verify node.js installed or not

node -v ##Should report version of node.js

  • Command to install npm [node package manager]

sudo apt-get install npm

  • Command to verify npm installed or not

npm -v ##Should report version of npm

In Windows 64/32 bit

  • Node.js – Download windows installer[.msi] file from the official Node.js home page
  • In that page select the Windows bit correctly and install it.
  • npm – Along with Node.js installation, npm will be installed.
  • In “Custom Setup” installation window, click “Add to path” and select “Will be installed on local hard drive” option to set environment variable for node.js and npm.
  • Once the node.js installation done, open command prompt and give the below command check whether node.js installed or not.
  • node -v #Should report node.js version
  • npm -v #Should report npm version

Note: Without setting the environment variable, you will get “not recognized” error.

Installing Node red

Once node.js and npm installed successfully, you can start installing the node-red.

In Ubuntu

  • Open terminal and use below command to install node-red

sudo npm install -g – -unsafe-perm node-red node-red-admin

  • Basically the “npm” will install the package in the current directory, but here we pass -g flag to install the package globally, so the package will be installed in /usr/local/bin directory.
  • After installation, you must enable the Ubuntu Firewall to allow node-red to access 1880 port, because node-red use 1880 port for user-interface.

sudo ufw allow 1880

  • To verify, node-red installed or not, open the terminal and type the below command


  • In terminal, “Welcome to node-red” message will print and at the end of that message you will get a URL like to view the user interface. Open your web browser and copy paste this URL to view it.

In Windows

npm install –global –production windows-build-tools

    • To verify node-red installed or not, open command prompt and use this command


  • In terminal, “Welcome to node-red” message will print and at the end of that message you will get a URL like to view the user interface. Open your web browser and copy paste this URL to view it.

Installation of Bevywise MQTTBroker

Refer our Bevywise MQTTBroker help document to install MQTT broker in Ubuntu and Windows.

Node Red MQTT Broker integration

Here we show you a basic Node red MQTT Broker integration. With this basic you can create a virtual IoT network in node-red and integrate to Bevywise MQTTBroker.

Configuring Node red

Start the node-red and open the user interface of node-red in your web browser. In node-red user interface, the left side lists are the node and in the right side tab, quick description about the node will be shown.

  • First, drag and drop the “inject” node from the input list.
  • Next, click the injects node and hit enter to edit the node.
  • In the edit panel, you can see below parameters which will help you to give input to the Bevywise MQTTBroker
  • Payload – If you click the drop down, you can see many formats for the payload, based on this format payload will be injected to MQTT.
  • Topic – Give a published topic with UTF-8 string followed by a forward slash. For example : Dairy/Milk/Tank/level
  • Repeat – This helps you to inject the payload, multiple time with an interval
  • Name – Any name
  • After configuring, click Done button to save it.
  • Next, drag and drop “mqtt” node from output list.
  • Click mqtt node and hit enter, to open edit panel.
  • Server – Give the IP address where you’re running Bevywise MQTT Broker
  • Topic – the MQTT topic to publish to.
  • QoS – Select one QoS value
  • Retain – Select true to enable retain, if not select false
  • Name – Any name
  • After configuring, click Done button to save it.
  • Now connect inject input node and MQTT output node.

After node-red configuration, start the Bevywise MQTT Broker. Once the Bevywise MQTT Broker, started the node-red will get connected and start the publishing.

Get started your node red MQTT broker integration  by downloading Bevywise MQTT Broker

download now


MQTT Broker Google Pubsub Integration

MQTT Broker Google Pubsub Integration

Google Pubsub is one of the leading Queue engine used to collect data from the publisher or MQTT Application for better data analytics. Integration of Bevywise MQTT Broker with Google Pubsub helps you push data from your IoT & IIoT edge devices via MQTT Broker to google pubsub.

Set up Google Compute for Pubsub

Google Pubsub is accessible from your Google cloud services account.  You can follow the Google Pubsub document to create Google Pubsub with a publish topic.


Create Ubuntu Instance

We will be running the Bevywise MQTT Broker on the Ubuntu instance which was created in Google Cloud. Refer to the Google help document for creating the Ubuntu instance. in Google cloud.


Installation Google Pub/Sub dependencies

Once you created an Ubuntu instance, login to that instance and install the below dependencies.

  • Open terminal and install below gloud cloud packages
  • sudo pip install google-cloud-core
  • sudo pip install google-api-core
  • sudo pip install –upgrade google-cloud-pubsub
  • Go to “/usr/local/lib/python2.7/dist-packages/PyInstaller/hooks/” folder.

cd /usr/local/lib/python2.7/dist-packages/PyInstaller/hooks/

  • In that foldder, open “” file by

sudo vim

  • In that file, remove all the default lines and add the below code

from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata(‘google-cloud-core’)
datas += copy_metadata(‘google-api-core’)
datas += copy_metadata(‘google-cloud-pubsub’)

  • save and exit file

MQTT Broker Google Pubsub Integration

  • Install Bevywise MQTTBroker in the created Ubuntu instance.
  • After installation, go to Bevywise/MQTT Broker/extension folder.
  • In that folder, open “” and replace the below code

import os
import sys
import json

from import pubsub_v1
project_Id = ‘project_name’
broker_Id = ‘testing’
def handle_Received_Payload(data):
global pubsub_v1
global project_Id
global broker_Id
publisher = pubsub_v1.PublisherClient()
topic_path = publisher.topic_path(project_Id, ‘broker’)
data = json.dumps(data)
data = data.encode(‘utf-8’)
publisher.publish(topic_path, data=data, device=broker_Id)

  • In this code, “project id” represent the project id which you while creating google pubsub
  • Save and exit the file
  • Go to Bevywise/MQTT Broker/conf folder
  • Open “data_store.conf” and change the following parameters


  • Save and exit the file.
  • If you want to run the MQTTBroker with authentication, then follow the steps
  • open Bevywise/MQTTBroker/conf folder
  • In that open “broker.conf” file and change


  • Save and exit the file.
  • Google Pubsub use grpc authentication, so we must export the grpc ssl certificate path in the “/etc/environment” to set the default path for grpc ssl root certificate.
  • Go to /etc folder and open “environment” file by

sudo vim environment

  • In that file, paste the below command and save it.

export GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=”usr/local/lib/python2.7/dist-packages/grpc/_cython/_credentials/roots.pem”

  • Next restarted the instance.
  • Once you restarted the instance, go to “Bevywise/MQTT Broker/bin” folder
  • Next start the Bevywise MQTTBroker by

sudo sh

Now Bevywise MQTTBroker collects the data from your edge device and send to the Google pub/sub via Custom store. From Google Pub/Sub, you can hook and send the data to your data analytics tool.

Get started your data analytics by downloading our MQTTbroker.

download now


5 reasons to choose an IoT Platform over MQTT Broker

5 reasons to choose an IoT Platform over MQTT Broker

IoT and Industry 4.0 together pave the way for smart industrial developments and every industry needs a dedicated & personalized IoT/Industry 4.0 implementation. Even within a specific industry in medium and large enterprises, there are cases where the processes may require customization or a custom implementation of the solution. Such requirements result in millions of distinct IoT implementations in the entire world. In order to build cost effective solutions, these million implementations will need a central M2M engine (MQTT Broker) or an IoT Platform.

This blog helps you identify whether you need an IoT Platform or simple MQTT Broker to get start with  implementation.

Save Money on your IoT Implementation :

The IOT Platform provides everything that needs to be a part of the central M2M communication, Data Storage, REST APIs and more, in order to run a complete solution for any IOT automation. Using an IoT Platform as part of your implementation will have more advantages and higher cost savings than using MQTT Broker. This makes your server ready without spending a huge amount of money and time on implementing the same.

Easy scale up:

IoT Platforms are designed and built with scaling up your IOT Solution to handle millions of devices. But, Most platforms are micro services-based allowing you to deploy only the service you need. In the industrial implementation, there are two scenarios.

  1. Less number of devices and more messages per device
  2. Lot of devices and lower frequency of messages per device.

You can deploy higher connections and higher message rates with components of platform accordingly as per the situation. This is something not possible with the broker unless you go for some huge customization of the broker.

Multi tenancy for your IoT Implementation:

Bevywise IoT Platform comes with multi tenancy. Most solutions today require more than one customer and you cannot have one instance per customer. Besides that Most industrial scenarios need Multi tenancy. Platforms implement multi tenancy from devices using different set of authentication keys, data processing & storage, and data analytics based on the organization.

Faster Time to market:

The core of any IoT Implementation is the edge device and the management of the devices using your mobile application. The IoT platforms provide REST based APIs and SDKs for the faster mobile application and other application integration. The platform helps to get you the complete IoT Solution up and running in days.

High Availability of IoT Platform:

IoT Platform comes with an in-built monitoring and self healing tools. The platform monitoring tools help in keeping the Dev-ops team informed of the server health. The self healing tools can be configured in such a way to restart the services based on the CPU and Memory usage, making the service work more reliably.

Try the hosted Bevywise IOT Platform now.

For more information on the Platform, download the brochure here.  Contact support for a hosting a white labeled Platform for your IoT Solution.