TH | EN

Getting Started

Creating Project

Login into the portal at https://portal.netpie.io. The list of all the projects that you have created can be viewed on this page. If you are logging for the first time, you will see no projects listed:

_images/project_list.png

Start creating a project by clicking plus sign “+” at the bottom of the page:

_images/project_create.png

Fill in the project information. The fields marked with (*) are required. Then click on the “Create” button, and the system will create the project as shown below. Click on the project to continue:

_images/project_first.png

Create Device

Upon entering each project, the following project overview screen will appear:

_images/project_overview.png

Create a new device by clicking on “Device Lists” in the menu on the left hand side:

_images/device_list.png

Click on “Create” button on the upper right corner to create a new device:

_images/device_create.png

Enter device information, fields marked with (*) are required. Then click on “Create” button, the system will create device as shown below:

_images/device_first.png

By clicking on each device, information associated with the device like Key, Token, and Secret (credentials) can be viewed. This information is used to connect the device to the platform:

_images/device_detail.png

Connect Device to Platform

A unique key is required to connect a device to the platform. The key associated with the device can be viewed on the platform portal as shown below:

_images/device_key2.png

To connect the device to the platform using MQTT protocol, the following parameters need to be specified:

Host

mqtt.netpie.io

Port

1883 (mqtt), 1884 (mqtts)

Client ID

Device ClientID created on NETPIE.

Username

Device Token created on NETPIE.

Password

(Not required)

Try connecting to the platform using the MQTT box, which can be downloaded from Chrome Web Store. Open the MQTT box once installed:

_images/mqttbox_create.png

Click on “Create MQTT Client” to establish connection with the MQTT server (NETPIE):

_images/mqttbox_config.png

Enter the input parameters carefully. Then click the “Save” button, the MQTT box will now connect to the NETPIE platform. If successful, you will see the “Connected” icon in green color as shown below:

_images/mqttbox_connected.png

Test the connection by publishing a message to yourself. Set the Topic value in Publish and Subscribe to ‘@msg/topic_name’. Click the “Subscribe” button before clicking “Publish”:

_images/mqttbox_self_pubsub.png

Communication between Devices

In order for devices to be able to communicate with each other, they must be grouped together. To do so, click “Device Groups” in the menu on the left-hand side:

_images/group_list.png

Create a new group by clicking on the “Create” button and fill in the information:

_images/group_create.png

On successful creation, the newly created group will appear as shown below:

_images/group_first.png

Go back to “Device Lists” and create a second device to try connecting two devices to each other:

_images/device_2item.png

Arrange both devices in the newly created group using the steps shown in the below picture:

_images/device_2group.png

Once the device is imported to Group, the name of the Group to which the device belongs can be viewed on the Device Lists:

_images/device_show_group.png

Now, try connecting the second device to the platform using HiveMQ, which can be downloaded from https://github.com/chavee/hivemq-mqtt-web-client. Once the download is completed, extract the .zip folder and open the ‘index.html’ file. Enter the Device’s ClientID in “ClientID” field, Device’s Token in “Username” field, and mqtt.netpie.io in the “Host” field:

_images/hivemq_config.png

Then click the “Connect” button to connect to the NETPIE platform:

_images/hivemq_connected.png

Head back to the webpage https://portal.netpie.io. You will see both the devices in the Device Lists are now active:

_images/device_online_list.png

Test communication between these two devices namely “switch” and “lamp”. Connect the “switch” to the platform using HiveMQ and “lamp” using MQTT box:

_images/mqttbox_hivemq.png

We will now send the message from “switch” to “lamp”, to turn on/off the light. To do so, set the “switch” to publish a message on topic “@msg/set/status” and set the “lamp” to subscribe to the topic “@msg/set/status”:

_images/msg_pub_sub.png