How-To Guides
DeviceHub Guides

Organize Device and Tag Data by Using Metadata

17min

When configuring DeviceHub devices and tags, you have the option of adding metadata, which allows you to define key-value pair data for the device output payload. The metadata can then be used to find, use, and reuse particular instances of data.

Some examples where using metadata would be beneficial include the following:

  • Device category metadata organizes devices.
  • Tag type metadata organizes tag categories.
  • Plant Floor ID metadata organizes different areas of a production site.
  • Location metadata organizes devices and plants across multiple worldwide sites.

User Scenario

For this user scenario, you will use device and tag metadata to organize your data using the following parameters:

  • The country and city the device is located in. In a real-life scenario, you may be using multiple Manufacturing Connect Edge instances across different locations that are managed by Manufacturing Connect.
  • The location (wing area) of the devices within each plant.
  • The category for each tag.

You will create four devices, with two tags each, totaling eight tags.

Step 1: Connect Devices

You will first connect all relevant devices in DeviceHub.

To connect devices:

  1. Navigate to DeviceHub. The Devices pane opens.
  2. Click Add New Device. The Connect Device dialog box appears.

    Connect a Device box
    Connect a Device box
    
  3. Click the Device Type drop-down list and select Simulator.
  4. Click the Driver Name drop-down list, and select Generator.

Configure the following four devices.

Device 1

  • Name: PLC_1
  • Meta Data: Select checkbox.
  • Key/Value pair 1
    • Key: Country
    • Value: US
  • Key/Value pair 2
    • Key: City
    • Value: Chicago
  • Key/Value pair 3:
    • Key: Device_Location
    • Value: South_Wing
  • Enable Alias Topics: To view the topic with an alias name instead of in raw format, select this checkbox. For Manufacturing Connect Edge version 3.5.2 and later, it is selected by default. Learn more about Alias Topics.

Device 2

  • Name: PLC_2
  • Meta Data: Select checkbox.
  • Key/Value pair 1
    • Key: Country
    • Value: US
  • Key/Value pair 2
    • Key: City
    • Value: Chicago
  • Key/Value pair 3
    • Key: Device_Location
    • Value: East_Wing
  • Enable Alias Topics: To view the topic with an alias name instead of in raw format, select this checkbox. For Manufacturing Connect Edge version 3.5.2 and later, it is selected by default. Learn more about Alias Topics.

Device 3

  • Name: PLC_3
  • Meta Data: Select checkbox.
  • Key/Value pair 1
    • Key: Country
    • Value: US
  • Key/Value pair 2
    • Key: City
    • Value: Cleveland
  • Key/Value pair 3
    • Key: Device_Location
    • Value: North_Wing
  • Enable Alias Topics: To view the topic with an alias name instead of in raw format, select this checkbox. For Manufacturing Connect Edge version 3.5.2 and later, it is selected by default. Learn more about Alias Topics.

Device 4

  • Name: PLC_4
  • Meta Data: Select checkbox.
  • Key/Value pair 1
    • Key: Country
    • Value: Canada
  • Key/Value pair 2
    • Key: City
    • Value: Toronto
  • Key/Value pair 3
    • Key: Device_Location
    • Value: North_Wing
  • Enable Alias Topics: To view the topic with an alias name instead of in raw format, select this checkbox. For Manufacturing Connect Edge version 3.5.2 and later, it is selected by default. Learn more about Alias Topics.

Step 2: Add Tags

You can now add tags to the devices you created. For this user scenario, the tags will be used to capture air pressure and temperature values, and each device can have multiple tags for each measurement.

To add tags:

  1. Navigate to DeviceHub > Tags.
  2. From the Tags pane, click Add New Tag, and then select Add One. The Add Tag dialog box appears.

    The Add New Tag icon
    The Add New Tag icon
    
  3. Click the Select a Device field, and then select the first device to add tags to.

Add the following eight tags.

PLC_1

Tag 1

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Temperature_1
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Temp

Tag 2

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Temperature_2
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Temp

PLC_2

Tag 1

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Temperature_1
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Temp

Tag 2

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Air_Pressure_1
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Pressure

PLC_3

Tag 1

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Air_Pressure_1
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Pressure

Tag 2

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Air_Pressure_2
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Pressure

PLC_4

Tag 1

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Air_Pressure_1
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Pressure

Tag 2

  • Name: S - Random value generator
  • Value Type: int64
  • Polling Interval: Enter 5. This is the time interval in seconds that the tag will be polled for data.
  • Tag Name: Temperature_1
  • Meta Data: Select checkbox.
  • Key/Value pair
    • Key: Category
    • Value: Temp

Step 3: View Data

You can now view the data from the devices and tags in Manufacturing Connect Edge through the Flows Manager.

View Data in Flows Manager

  1. Navigate to DeviceHub. The Devices pane opens.
  2. For the PLC_1 device tile, open the Action menu, click Copy topics, and select the device topic name. Store the topic name somewhere for use later. The ">" indicates a wildcard character, so the topic name applies to all tags for the device.

    Device topic name
    Device topic name
    
  3. Copy and store the device topic names for all other devices.
  4. Navigate to Flows Manager.
  5. For a Flows Manager, click the Go To Flow Definition icon. The Flow canvas opens in a new browser tab.

    Go To Flow Definition icon
    Go To Flow Definition icon
    
  6. On the Flow canvas, drag four DataHub Subscribe nodes and four debug nodes onto the canvas. Then, connect the nodes.

    Flow canvas nodes
    Flow canvas nodes
    
  7. Double-click the first DataHub subscribe node. The Edit DataHub Subscribe node dialog box appears.
    • In the Topic field, paste the wildcard topic name for the device copied in step 2.
    • If needed, configure the Datahub Subscribe connection. See the Configure Connector Nodes section to learn more.
    • In the Name field, enter PLC_1.
    • Click Done.
  8. Continue configuring the other three DataHub Subscribe nodes for the other devices.

    Four DataHub Subscribe nodes configured
    Four DataHub Subscribe nodes configured
    
  9. Click Deploy.
  10. Expand the message window beneath the flow to view debug messages.

    The message window
    The message window
    
  11. Click the Debug icon.

    The Debug icon
    The Debug icon
    
  12. Make sure the four debug nodes are activated.

    Activate buttons
    Activate buttons
    
  13. View the data in the debug window. The payload below shows data from each tag in each of the four devices. The device and tag metadata is included at the end of each payload item.
Payload from four devices
Payload from four devices


View Payload Data

Review the payload data from the debug window for each DeviceHub device.

PLC_3
PLC_3
PLC_1
PLC_1
PLC_2
PLC_2
PLC_4
PLC_4