Azure Integration enables LoopEdge to publish data directly to the Microsoft Azure cloud. The following sections describe LoopEdge integration with the Azure IoT Hub.
Configure the Azure IoT Hub
This section goes over creating an Azure IoT Hub, Adding Devices to Azure, and finding required connection parameters for LoopEdge connectivity.
Create an IoT Hub
- Navigate to https://portal.azure.com . Log in with your Azure account, or create a new account.
- Click Create a Resource, then search for Iot Hub in the search bar.
- Click Iot Hub, then click Create.
- Select your Subscription, Azure Resource Group, Region, and IoT Hub Name.
- Choose the Pricing and Scale of your IoT hub depending on the number of connected devices to host on Azure and send messages to from LoopEdge.
- Click Review + Create to finalize creating the IoT Hub and begin adding devices to it.
Add an IoT Device
- From the Azure portal, open the Command-Line-Interface (CLI)
In the Azure CLI, type the following two commands:
Make sure to replace YourIoTHubName with the name of your IoT Hub and to replace MyNodeDevice with the name that you want to have for your device.
- Click your IoT Hub from the Azure Portal, then click IoT devices from the left-hand-side to check that you successfully added the new device.
Note Connection Details
- From the Azure IoT Hub, click Iot devices from the panel on the left-hand-side.
- From the list, click the Azure device listing to send messages to from LoopEdge.
- Note the connection details to configure an Azure connector in LoopEdge.
Configure the LoopEdge Azure Connector
- From the LoopEdge navigation panel, click Integration.
- Click to add a new connector.
- Select MQTT - Azure IoT Hub over SSL as the Provider.
Configure each field for the connector. Refer to the descriptions below for details:
- Click OK to finish the configuration and enable the connector.
- Click the connector from LoopEdge, then click to start sending data to Azure from a LoopEdge topic.
- Copy and paste the raw or IPSO topic in LoopEdge, then check Enable to begin sending data to the Azure cloud.
Read Outbound Device-to-Cloud Messages
This section covers the simplest way of ensuring connectivity to the Azure cloud by reading device-to-cloud messages sent from LoopEdge.
- Download Visual Studio Code from: https://code.visualstudio.com/
From Visual Studio Code, install the IoT Hub Toolkit:
Connect your Azure account to the IoT Hub Toolkit when prompted.
Select the IoT Hub of your choice from the More Actions... option.
- From the same menu, click Star Monitoring D2C to view messages being sent from LoopEdge devices to the Azure cloud.
Read Inbound Cloud-to-Device Messages
This section covers the simplest way to send and view inbound messages from Azure to LoopEdge.
- Edit an existing Integration for the Azure connector, or create a new one.
In the Integration Topic field, enter the following topic to enable Inbound connectivity from Azure to LoopEdge:
deviceid should be your Azure device id on the Azure IoT Hub
- Click the Azure Connector, and add an integration topic for Inbound connectivity. Choose any name, and make sure to enable the Topic.
- Copy the Inbound topic.
- Open Flows. Add a Datahub node and a Debug node to the canvas.
- Paste the Inbound topic into the Datahub node. Make sure to connect the nodes, and Save the flow.
- Click the IoT device for LoopEdge on the Azure IoT Hub. Click Message to Device.
- Type a message of your choosing into the Message Body, click Send Message.
- View the message in the Flow that you set up in an earlier step: