October 15th, 2019

Easily send random generated D2C messages to IoT Hub with Azure IoT Hub Tools

Zhenwei Zhang
SWE INTERN

Z, a software engineer, developed an application about a smart home assistant using Azure IoT service, and he wonders if the application works fine. He want to send messages indicating time and temperature to IoT Hub from many devices simultaneously each for many iterations, so these messages should be formed in a similar template but the data should be randomly generated for each message, and he want to send these message repeatedly, each with a fixed interval, like one second, as is done by true temperature sensors.

This is a very common scenario in IoT development, frustrating a lot of programmers. Here is the good news for Z, and for all of you: You can get rid of all these trivial things with the help of our new feature!

We improved the function in Azure IoT Hub Toolkit (part of the Azure IoT Tools extension pack now) to help you quickly send D2C messages. You only need to specify the device(s), the number of iteration(s), the delivery interval, and the data template. And then we will randomly generate data in your specified format for you and send it out.

Sending your own D2C Messages

In order to use the new feature, you need to install the latest version of Azure IoT Hub Toolkit. After installed the latest version, launch the send D2C Messages WebView by clicking Send D2C Message to IoT Hub in the context menu.

After launched the WebView, select the device(s) you want to send message(s) from, and fill in all the fields in the WebView as what you want or just keep the default sample values. Click the send button to start sending D2C messages.

After you started sending D2C messages, you can see the progress info in WebView. Feel free to close the WebView anytime, Azure IoT Hub Toolkit will keep sending D2C messages in the background. And you can launch the WebView again at any time to see the latest status. Once the simulation is done, the summaries will be printed in the output channel.

You can send message(s) in plain text, or in Dummy JSON. Dummy JSON is a Node utility that allows you to generate random JSON data using Handlebars templates. You can visit Dummy JSON GitHub for more information about the syntax.

Have a try

Please visit Azure IoT Tools in the Marketplace. Install the Azure IoT Tools extension or update the Azure IoT Toolkit to the latest version and try it in your Visual Studio Code.

If you have any feedback, feel free to open new issues on our GitHub.

Author

Zhenwei Zhang
SWE INTERN

0 comments

Discussion are closed.