Use the Manage Topic to Stop a Device
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 Manage topic allows you to control the status of a DeviceHub device.
You'd like to remotely disconnect a PLC from Manufacturing Connect Edge.
To set up and use the Manage 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 Manage topic. This will copy the Manage 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, copy the DataHub Publish node and inject node onto the canvas. Then, connect the two nodes.
- 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.
For msg.payload, select string.
For msg.payload, enter {"command" : "stop"}.
- Click Done, and then click Deploy.
Click the inject button. This triggers the payload message you configured for the node.
Return to the Manufacturing Connect Edge browser window and navigate to DeviceHub. The device now shows a Stopped status.
To restart the device, you can use the following command: {"command" : "start"}.