---
title: Use the PLC-Status Topic to Verify Connection Status
slug: manufacturing-connect-edge-v2/use-the-plc-status-topic-to-verify-connection-status
docTags: 
createdAt: 2023-09-27T15:19:40.497Z
---

:::hint{type="info"}
**Notes**:

- You need to follow the following guidelines for topic names: [Subject-Based Messaging](https://docs.nats.io/nats-concepts/subjects).&#x20;
- 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&#x20;**&#x6E;ode.&#x20;
:::

The PLC-status topic is used to verify the connection of DeviceHub devices.&#x20;

# User Scenario

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

# Set up and Use the PLC-Status Topic

**To set up and use the PLC-status topic:&#x20;**

1. Follow the steps to [Connect a Device](docId\:SqalV8ImyZmn8xA-56gno). For this user scenario, a Simulator Generator device is used.&#x20;
2. Navigate to **DeviceHub**.&#x20;
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.
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/WllvAJs-JrjyzTlsfp5J0_plc-statusmce.png" size="80" width="803" height="427" caption="Copy the PLC status topic" position="center" showCaption="true"}
4. Navigate to **Flows Manager**.&#x20;
5. For a Flows Manager, click the **Go To Flow Definition** icon.&#x20;
   The Flow canvas opens in a new browser tab.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/6jHtiMzararcFdy6pdnHt_go-to-flow-definitionmce.png" size="80" width="937" height="548" caption="Go To Flow Definition icon" position="center" showCaption="true"}
6. On the Flow canvas, drag the **Datahub Subscribe** node and **debug&#x20;**&#x6E;ode onto the canvas. Then, connect the two nodes.&#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/rFBhmtBOhyKLZca06yEtQ_plc-status-nodes.png" size="80" width="870" height="494" caption="Nodes needed for PLC status" position="center" showCaption="true"}
7. Double-click the **DataHub Subscribe** node.
   The *Edit DataHub Subscribe node* dialog box appears.
   - In the **Topic&#x20;**&#x66;ield, paste the PLC status topic you copied in step 3.&#x20;
   - If needed, configure the Datahub Subscribe connection. See the *Step 3: Configure Connector Nodes* section in [Create a Flow](docId\:cvhYwrcRDrQPGReHBQNZ-) to learn more.&#x20;
   - Click **Done**, and then click **Deploy**.&#x20;
8. Expand the message window beneath the flow. &#x20;
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/JX5Q6gfezPd36MMFlrwFH_message-bar.png" size="80" width="1920" height="937" caption="The message window" position="center" showCaption="true"}
9. Click the **Debug&#x20;**&#x69;con to view debug messages
   ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/JC4cy7D-QXdzNqDI_czdP_debug-icon.png" size="80" width="1920" height="643" caption="The Debug icon" position="center" showCaption="true"}
10. Confirm the **Debug&#x20;**&#x6E;ode is activated.&#x20;
    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/Ape1kZ4p0O1vNuxlL6wr4_activate-debug.png" size="80" width="1062" height="648" caption="The activate debug button" position="center" showCaption="true"}
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. &#x20;
    ::Image[]{src="https://api.archbee.com/api/optimize/SSUUxKZUk9bFTEPNn_6Zo/k9cbCEQNSQyQzuHN7_1j2_success-true.png" size="80" width="1616" height="767" caption="Success true message" position="center" showCaption="true"}

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.&#x20;
- **Value**: The bit value that displays the status of the device. The value 0 means the device is on/connected.&#x20;
- **Device Name**: The device name you configured in Manufacturing Connect Edge.&#x20;
- **Timestamp**: Date and time data for the PLC status message.&#x20;
- **Device ID**: The device ID for the DataHub device generated in Manufacturing Connect Edge.&#x20;
- **Description**: The default description for the PLC status topic (Poll Register).&#x20;

