Setting Up Node-RED to Transmit Wzzard Data to Microsoft Azure … · 2020. 2. 20. · • In Add...

Post on 11-Mar-2021

6 views 0 download

Transcript of Setting Up Node-RED to Transmit Wzzard Data to Microsoft Azure … · 2020. 2. 20. · • In Add...

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 1 0819

Setting Up Node-RED to Transmit Wzzard™ Data to Microsoft Azure IoT Hub

How to publish data from Wzzard Mesh Edge Nodes into the Microsoft Azure IoT Hub using Node-RED

NOTE: This assumes your Gateway is set up and claimed on WebAccess/DMP (formerly SmartWorx Hub) and the Refrigeration demo flow is loaded and working. NOTE: This assumes that the user has an Azure account.

Prepare the Gateway

• Log into WebAccess/DMP and manage your device.

• Select Devices > View Devices and select your Device ID.

• Under Manage Apps, ensure RSMessageBroker, Wzzard Mesh and NodeRED are installed. If not, install them by selecting the Add/Upgrade Apps tab.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 2 0819

Add Microsoft Azure IoT Hub Node

• Navigate: Dashboard > Devices > Manage Devices > Settings • Click on the NodeRED link on the Manage Apps table.

• In Add or Remove Nodes box, in Node field, type node-red-contrib-azureiothubnode

• Then, click Apply Changes button.

• Wait for SmartWorx Hub to sync with your gateway. This may take several minutes.

• You can view the status by doing the following: click Manage Devices, then click the History tab.

• Proceed with the next step once the AddNode command has been added. Note: you may need to refresh the NodeRED page for your pallet to be updated.

• You will see the node-red-contrib-azureiothubnode node under Cloud (as shown in the next screen).

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 3 0819

NodeRED Setup • Log into the gateway NodeRED editor. Default address is: 192.168.1.1:1880

• Username is NodeRED. Password is the same as Gateway password (5mart5warm default).

• Scroll down on the left side and ensure the Azure IoT hub node is loaded.

• Access the text from the SampleFlow.txt file - located in the Attachments panel to the upper-left of this document in Adobe Acrobat:

View > Navigation Panel > Attachments • Open it in Notepad (double-click) or a similar editor program.

• Carefully select and copy all of the text to the clipboard.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 4 0819

• Back in Node-RED editor, add a new flow by clicking on the + sign in the upper right of the window.

• Then, click on the 3 horizontal lines next to Deploy button, select Import, then select Clipboard.

• Paste the text from the text file into the grey Import nodes box and click Import.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 5 0819

Connect to IoT Hub

• Log into your Azure IoT hub and click on Add to add a new device.

• Name your device in the Device ID field. Click Save.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 6 0819

• Next, open your new device and copy the Connection string (primary key) to Notepad or

a similar editor program.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 7 0819

• Back in Node-RED editor, click on the node labelled Azure IoT Hub and paste in the Connection

String text from above.

• Then click Done.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 8 0819

Set Up Data String

• Click on the function labeled Generate Data String.

• Replace the deviceID and the Shared Access Key (SAK) with the deviceID and key from your Connection String that you downloaded from the Azure IoT hub. Click Done.

Wzzard Data to Azure IoT Hub Using Node-RED

www.advantech.com 9 0819

Deploy the App • Next, press the Deploy button on the upper right side of the Node-RED editor.

Deployment may take several minutes.

• Your data should now be published to your IoT hub.

ADVANTECH TECHNICAL SUPPORT

USA/Canada: 1 (800) 346-3119 (Ottawa IL USA location) Europe: +353 91 792444 (Ireland location) Email: support@advantech-bb.com Web: www.advantech-bb.com Wzzard is a trademark of Advantech. Other brands or product names may be trademarks and are the property of their respective companies.