cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Connect Azure IoT Devices Part 2

No ratings

 

Step 7: Set-up and Run Demo

 

The ThingWorx Azure IoT Connector download includes a Java application that simulates a device connecting to your Azure IoT Hub. A ThingTemplate is also included and can be imported into ThingWorx.

 

Import Demo Templates

 

  1. In ThingWorx Composer, click Import/Export menu, then click From File and browse to ../demo/edgedevice- demo/platform/entities/CPUDemo_AllEntities.xml

    foundation_QS_uploadSimulator.png

     

  2. Click Import then click Close when the import successful message is displayed.
  3. Create a new Thing using the imported template azureDemo1, enter a name for your Thing and click Save.

    NOTE: You will enter this name in the demo config file in the next step.

Configure Demo Application

 

  1. In the ../demo/edge-device-demo/conf subdirectory, open the edge-device.conf file with a text editor.
  2. Edit the deviceId to be the name of the Thing you created in step 3.
  3. Edit the iotHubHostName to use the name of your hub plus the domain: azure-devices.net. For example, sample-iot-hub.azuredevices.net.
  4. Edit the registryPolicyKey property to use the Primary Key for the registryReadWrite policy in the Azure IoT Hub.

Below is an example configuration:

azure-edge-device {
  deviceId = "alstestedgething"
  iotHubHostname = "alsiot.azure-devices.net"
  registryPolicyName = "registryReadWrite"
  registryPolicyKey = "pzXAi2nonYWsr3R7KVX9WuzV/1234567NZVTuScl/Kg=" }

 

Run Demo Script

 

  1. Open a shell or Command Prompt, set the EDGE_DEVICE_DEMO_OPTS environment variable to refer to the file you just edited:
    • Linux - export EDGE_DEVICE_DEMO_OPTS="-Dconfig.file=../conf/edge-device.conf"
    • Windows - set EDGE_DEVICE_DEMO_OPTS="-Dconfig.file=../conf/edge-device.conf"
  2. Launch the demo from the ../demo/edge-device-demo/bin subdirectory, using the edge-device-demo command.
  3. Return to the ThingWorx Composer and open the Properties page of the Azure Thing that you created previously.
  4. Click the refresh button to see the properties change every five seconds.
  5. Open the azure-iot-demo Mashup and view the Load Average and CPU gauges, and the increases in the values of the Cycle and Uptime fields.

    NOTE: If the edgedevice-demo is running on Windows, the Load Average does not register.

    demo_mashup.png

 

Step 8: Next Steps

 

Congratulations! You've successfully completed the Connect Azure IoT Hub to ThingWorx Quickstart. By following the steps in this lesson, you imported a device created in Azure into ThingWorx and saw how data from an Azure device could be used in a ThingWorx Mashup.

 

Learn More

 

We recommend the following resources to continue your learning experience:

 

If you're following the Azure MXChip Development Kit learning path, the next guide is Create a Thing Shape.

 

 Capability     Guide
ConnectChoose a Connectivity Method
BuildDesign Your Data Model
ExperienceCreate Your Application UI

 

Additional Resources

 

If you have questions, issues, or need additional information, refer to:

 Resource       Link
CommunityDeveloper Community Forum
SupportGetting Started with ThingWorx
 

 

 

 

Version history
Last update:
‎Nov 17, 2022 05:19 PM
Updated by:
Labels (2)
Contributors