Use the PLC-Status Topic to Verify Connection Status
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.
The PLC-status topic is used to verify the connection of DeviceHub devices.
You'd like to verify the connection status of a PLC to Manufacturing Connect Edge from a remote location.
To set up and use the PLC-status topic:
- Follow the steps to Connect a Device. For this user scenario, a Simulator Generator device is used.
- Navigate to DeviceHub.
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.
- Navigate to Flows Manager.
For a Flows Manager, click the Go To Flow Definition icon. The Flow canvas opens in a new browser tab.
On the Flow canvas, drag the Datahub Subscribe node and debug node onto the canvas. Then, connect the two nodes.
- 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.
Expand the message window beneath the flow.
Click the Debug icon to view debug messages
Confirm the Debug node is activated.
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.
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).