Skip to content

bastisk/IoT-Prototype-Gateway

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IoTPrototype - Protocol Gateway

This repository contains an application for adapting MQTT messages to Azure IoTHub. It uses Mosca as MQTT broker and the Azure IoT Node.JS SDK to send messages to IoTHub.

NOTE: Azure IoTHub now supports MQTT natively (take a look at the article).

This application currently only supports device to cloud messages.

Installation

Clone the repository, then run

npm install

to install all needed packages.

Configuration

In connection.js change the contents of variable "hubName" to your IoTHub name.

Configure the following client fields on your MQTT client:

  • password=DeviceKey
  • username=DeviceId
  • topic=DeviceId/Topic

The application will then forward this information to the devicespecific endpoint at Azure IoTHub.

You can optain the information on DeviceKey and DeviceId by using Device Explorer.

Running

To run the application execute

node app.js

Test / Preview

To test or preview the functionality you can edit the file client.js and enter your IoTHub credentials. The script will send 100 Messages to IoTHub (one message per second). You can see the incoming messages by using Device Explorer.

To run this script execute

node client.js

on the same system that runs the main protocol gateway application.

About

A Node.JS based Protocol Adapter for Azure IoTHub

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published