DataHub Nodes

Estimated reading time: 1 minute

The DataHub nodes provided in OT Link Platform Flows can be used to publish and subscribe to DataHub topics.


## DataHub (Publish) Node The DataHub input node is used to send data to the local topic. The local topic is defined in the DataHub section. The local topic is connected to the cloud connector on the DataHub page. The user uses the same topic to send data to the local topic. Select the server and enter the topic in order to publish data to the local DataHub. ```js [{ "id": "bfa9c926.270da8", "type": "tab", "label": "Dmitri's Flow" }, { "id": "82f14e62.36182", "type": "Datahub Publish", "z": "bfa9c926.270da8", "name": "", "natc": "", "topicname": "", "x": 300, "y": 200, "wires": [] } ] ```
## DataHub (Subscribe) Node The Datahub output node is used to get data from the local topic. Data being published to the local topic can be subscribed using the Datahub output flow. The legacy devices connected to DeviceHub publish their data to a local topic, which can be published from and subscribed to a cloud connection to send it to the cloud. Select the server and the topic in order to subscribe to the local DataHub. ```js [{ "id": "28a47eb0.f0cf92", "type": "tab", "label": "Test" }, { "id": "e7e93943.28cf68", "type": "Datahub Subscribe", "z": "28a47eb0.f0cf92", "name": "", "natc": "", "topicname": "", "x": 280, "y": 240, "wires": [ [] ] } ] ``` ## Example of Publishing Data Using a DataHub Node Inject the data being calculated to the **Datahub Publish** node. The data will be sent to the topic defined in DataHub. **Relevant references:** * [Flow to Write to Tags](/docs/otlink-wo/Flow-to-Write-to-Tags.html) ## Example of Subscribing to a Topic using a DataHub Node Data coming to the local topic can be subscribed to using the Datahub subscribe topic. DeviceHub sends data to the default topic 'devicehub/#' and it can be collected on the flow using data hub subscribe. Any calculation can be performed on the data received using flows.