Topic Use Cases (PLC Status, Poll-once, Write, Manage, Batch Write)
Refer to the following use cases for DeviceHub topics.
Notes:
- When publishing structured data such as JSON, you must convert to a byte array (string) first. To do this in a flow, you can use the json node.
Add DeviceHub Device
For these use cases, follow the steps to Connect a Device and make the following selections.
Device Type: Simulator
Driver Name: Generator
Name: Enter a name for the device.
After adding the device, it shows a connected status. The Generator device will be used to simulate a PLC device connected to Belden Horizon Data Operations.

Use Case 1: PLC Status Topic
The PLC status topic is used to verify the connection of DeviceHub devices.
To use the PLC status topic:
- Follow the steps in the Add DeviceHub Device section.
- Navigate to DeviceHub.
- Navigate to Flows Manager.
- Double-click the DataHub Subscribe node. The Edit DataHub Subscribe node dialog box appears.
- In the Topic field, paste the PLC status topic you copied in step 3.
- If needed, configure the Datahub Subscribe connection. See the Step 3: Configure Connector Nodes section in Create a Flow to learn more.
- Click Done, and then click Deploy.
The rest of the payload displays the following information from the device:
- Data type: The data type used to verify the PLC status. The bit data type displays two values: 0 for on/connected and 1 for off/disconnected.
- Value: The bit value that displays the status of the device. The value 0 means the device is on/connected.
- Device Name: The device name you configured in Belden Horizon Data Operations.
- Timestamp: Date and time data for the PLC status message.
- Device ID: The device ID for the DataHub device generated in Belden Horizon Data Operations.
- Description: The default description for the PLC status topic (Poll Register).
Use Case 2: Manage Topic
The Manage topic allows you to control the DeviceHub device.
For this use case, you will stop the DeviceHub device using the Manage topic.
To use the Manage topic:
- Follow the steps in the Add DeviceHub Device section.
- Navigate to DeviceHub.
- Navigate to Flows Manager.
- Double-click the DataHub Publish node.
- In the Topic field, paste the Manage topic you copied in step 3.
- If needed, configure the Datahub Subscribe connection. See the Step 3: Configure Connector Nodes section in Create a Flow to learn more.
- Click Done.
- Double-click the inject node. The Edit inject node dialog box displays.
- Click Done, and then click Deploy.
To restart the device, you can use the following command: {"command" : "resume"}.
Use Case 3: Poll-Once Topic
The Poll-once topic is used for tags that have a poll interval set to 0. If there is no poll interval, you can use the Poll-once topic to retrieve a register value when an event occurs. The poll-once topic will manually trigger the polling of register values.
To use the Poll-once topic:
- Follow the steps in the Add DeviceHub Device section.
- Name: S - Random value generator
- Value Type: int64
- Polling Interval: 0
- Tag Name: Enter a name for the tag.
- Address: 1
- Navigate to Flows Manager.
- Double-click the DataHub Publish node. The Edit DataHub Publish node dialog box displays.
- In the Topic field, paste the Poll-once topic you copied in step 5.
- If needed, configure the Datahub Subscribe connection. See the Step 3: Configure Connector Nodes section in Create a Flow to learn more.
- Click Done.
- Double-click the DataHub Subscribe node. The Edit DataHub Subscribe node dialog box displays.
- In the Topic field, paste the Raw Topic you copied in step 2.
- Click Done, and then Deploy.
The rest of the payload displays the following information for the tag:
- Data Type: The data type configured for the tag you created in step 1.
- Timestamp: Date and time data for the poll-once message.
- Register ID: The register ID for the tag generated in Belden Horizon Data Operations.
- Value: The value generated for the tag when the poll was triggered. Since the tag was configured with S - Random value generator, a random value is generated.
- Device ID: The device ID for the DataHub device generated in Belden Horizon Data Operations.
- Tag Name: The name you configured for the tag.
- Device Name: The name you configured for the device.
- Description: The description you entered for the tag. Since no description was entered for the tag in this use case, no value was displayed.
- Metadata: The meta data configured for the tag. Since no meta data was configured for the tag in this use case, no value was displayed.
Use Case 4: Write Topic
The Write Topic allows you to write data to a PLC device.
Step 1: Send Data to the Write Topic
You will first send the data to the Write topic.
To send the data to the Write topic:
- Follow the steps in the Add DeviceHub Device section.
- Name: M - Memory Register
- Value Type: int64
- Polling Interval: 5
- Tag Name: Enter a name for the tag.
- Address: 1
- Double-click the DataHub Publish node. The Edit DataHub Publish node dialog box displays.
- In the Topic field, paste the Write topic you copied in step 4.
- If needed, configure the Datahub Subscribe connection. See the Step 3: Configure Connector Nodes section in Create a Flow to learn more.
- Click Done.
- Double-click the inject node. The Edit inject node dialog box displays.
- For msg.payload, update the timestamp selection and select string.
- In the string field, enter test.
- Click Done.
- Click Deploy.
After sending the data to the Write topic, you can then read the data that was sent.
Step 2: Read Data That Was Sent
To read the data that was sent:
- Double-click the DataHub Subscribe node. The Edit DataHub Subscribe node dialog box displays.
- In the Topic field, paste the Write Topic you copied in step 4.
- Click Done, and then Deploy.
Use Case 5: Batch Write Topic
You can use the Batch Write Topic to send multiple write requests simultaneously.
Important:
- Only Gen 2 drivers can use batch write topics. See the Industrial Systems Connection Guide to review available Gen 2 drivers.
- This is only available for devices that don't select the Enable Alias Topics check box in the device configuration. You must use tags in the raw topic format. See Connect a Device and Manage Devices for more information.
Before You Begin
You will need the register IDs for the tags included in the batch write operation. If you don't have these values, you can get them by completing the steps in Step 2: Configure Nodes below.
Step 1: Set Up Flow Canvas
To set up the Flow canvas:
- Follow the steps in the Add DeviceHub Device section.
- Name: M - Memory Register
- Value Type: int64
- Polling Interval: 10
- Tag Name: Enter a name for each tag.
- Address: Enter 1 for the first tag, 2 for the second, and 3 for the third.
- Navigate to DeviceHub > Devices.
- Navigate to Flows Manager.
You can now configure the nodes on the canvas.
Step 2: Configure Nodes
To configure the nodes:
- Double-click the DataHub Subscribe node. The Edit DataHub Subscribe node dialog box displays.
- In the Topic field, paste the Raw topic you copied previously.
- If needed, configure the Datahub Subscribe connection. See the Step 3: Configure Connector Nodes section in Create a Flow to learn more.
- Click Done, and then click Deploy.
- Double-click the inject node.
- For msg.payload, update the timestamp selection and select string.
- In the string field, enter the payload in the following format: {"registerID_1": value_1, "registerID_2": value_2, "registerID_3": value_3}. Keep in mind that the order of the register IDs you configure is based on the address values you configured for the tags. value_1, value_2, value_3 can be replaced with any value of your choosing.
- For example, for this use case, the payload will be: {"C3E1CC7C-143F-46DA-BB70-C40196E56763": 11, "BE047C8C-875F-4D47-84AE-4D224733FE1D": 22, "BB1D6677-F4AE-41FD-A5AA-25E9E4AC7917": 33}. The first register ID is the one configured with Address 1 in the tag configuration, the second register ID is the one configured with Address 2, and the third register ID is the one configured with Address 3. 11, 22, 33 are values chosen for this example.
- Click Done.
- Double-click the DataHub Publish node. The Edit DataHub Publish node dialog box displays.
- In the Topic field, paste the Manage topic you copied previously. Then, replace manage in the topic with batch_write. For example, devicehub.manage.0F992AC9-4A73-4D7A-8134-6AB374BBE628 is changed to devicehub.batch_write.0F992AC9-4A73-4D7A-8134-6AB374BBE628.
- Click Done, and then click Deploy.
You can now send the batch data to the device tags.
Step 3: Send Batch Data
To send the batch data:








































