Building Connected Things with Node.js, Johnny-Five, and Microsoft Azure

Sending Device-to-Cloud (D2C) Messages

In this lab, you will capture data from the ThingLabs Thingy and send messages from the device to the Cloud using the Azure IoT SDK for Node.js.

The code for the final lab has been already created as part of the previous labs and all we have to do is make the Web app aware of our IoT Hub to be able to push messages to IoT devices.

Add IoT Hub Connection String

In the Azure portal, add another App setting called THINGLABS_IOTHUB_CONNSTRING and paste your IoT Hub connection string as the value.

Add Connection String

Use Web UI to toggle LED state

In the Web app UI, there is a form to which you write the ID of your IoT device. This ID is the one you used when the IoT device was created.