How-To Guides
DeviceHub Guides

Use the PLC-Status Topic to Verify Connection Status

3min

Notes:

  • You need to follow the following guidelines for topic names: Subject-Based Messaging.
  • 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.

The PLC-status topic is used to verify the connection of DeviceHub devices.

User Scenario

You'd like to verify the connection status of a PLC to Manufacturing Connect Edge from a remote location.

Set up and Use the PLC-Status Topic

To set up and use the PLC-status topic:

  1. Follow the steps to Connect a Device. For this user scenario, a Simulator Generator device is used.
  2. Navigate to DeviceHub.
  3. In the Generator device tile, click the Action menu, click Copy Topics, and then select the PLC status topic. This will copy the PLC status topic. You will refer to this topic later on.

    Copy the PLC status topic
    Copy the PLC status topic
    
  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 the Datahub Subscribe node and debug node onto the canvas. Then, connect the two nodes.

    Nodes needed for PLC status
    Nodes needed for PLC status
    
  7. 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.
  8. Expand the message window beneath the flow.

    The message window
    The message window
    
  9. Click the Debug icon to view debug messages

    The Debug icon
    The Debug icon
    
  10. Confirm the Debug node is activated.

    The activate debug button
    The activate debug button
    
  11. The debug window displays a "success": true message, which means the device is successfully connected to Manufacturing Connect Edge. If the device is not connected, did not respond in time, or is not properly configured in Manufacturing Connect Edge, "success": false will display.

    Success true message
    Success true message
    

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 Manufacturing Connect Edge.
  • Timestamp: Date and time data for the PLC status message.
  • Device ID: The device ID for the DataHub device generated in Manufacturing Connect Edge.
  • Description: The default description for the PLC status topic (Poll Register).