Articles in this section

How to install and configure Cogent DataHub

SUMMARY

Use this guide to install and configure Cogent DataHub to transfer data from an OPC UA server to Factbird using MQTT. This guide uses Kepware as the OPC UA server, but the same configuration can be adapted for other OPC UA servers

WHEN TO USE THIS

Use this guide if:

  • You are connecting an OPC UA server to Factbird.
  • You are using Cogent DataHub as the data gateway.
  • You need to publish production data to Factbird using MQTT.

PREREQUISITES

Before starting:

  • Cogent DataHub has been downloaded.
  • You have access to an OPC UA server (for example, Kepware).
  • Factbird has provided the MQTT host, client ID, topic, and client certificate.
  • You have permission to configure the OPC UA server and Cogent DataHub.

STEPS

  1. Install Cogent DataHub™

    • Run the Cogent DataHub installer.
    • Select the required components:
      • OPC UA (Unified Architecture)
      • MQTT Client
    • Complete the installation.







       

    Note

    • During initial setup, DataHub installs under the current Windows user.
    • For production environments, Factbird recommends configuring DataHub to run as a Windows service after testing is complete. 
  2. Configure the general settings

    • Open Cogent DataHub.
    • Disable Do not transmit insignificant changes.




       

    This ensures data is transmitted when only the timestamp changes, which is required by Factbird.

  3. Configure the OPC UA connection

    • Create a new OPC UA connection.
    • Enter the OPC UA server endpoint URL.
    • Configure the required security settings.
    • Test the connection.
    • Trust the server certificate when prompted.
    • Approve the DataHub client certificate on the OPC UA server.
    • Test the connection again.



    Once connected:

    • Set the Read Method to Synchronous Cache Read.
    • Optionally configure a Data Domain Name.
    • Select the OPC UA nodes that should be transferred to Factbird.





       
  4. Configure the MQTT connection

    • Create a new MQTT Client connection.

    • Configure the connection using the values provided by Factbird:
      • Host Name
      • Port 8883
      • SSL enabled
      • Client certificate
      • Client ID
      • MQTT Topic


    Configure the message settings:

    • Quality of Service: At least Once (QoS 1)
    • Retain Messages: Disabled
    • Message Format: Advanced






    Import the Factbird MQTT message template.
     

  5. <?xml version="1.0" encoding="utf-8"?>

    <AdvancedFormatTemplate xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

      <Name>FactBirdPub AWS</Name>

      <Parser>

        <Name>FactBirdPub</Name>

        <ReceiveProcessingScript>app.ProcessJson();</ReceiveProcessingScript>

        <EnableReceiveProcessor>false</EnableReceiveProcessor>

        <EnableSendDocument>false</EnableSendDocument>

        <IsEnabled>true</IsEnabled>

        <IsDefaultPublisher>true</IsDefaultPublisher>

        <PublishFormats>

          <JsonPublishFormat>

            <Name>FactBird</Name>

            <Text>&lt;% var JTimestamp = DateTime.UtcNow.ToJsonTime(); %&gt;

    {

      "values": [

      &lt;%

                      var point; var i; for (i = 0; i &lt; points.Length; i++)

                      {

                        point = points[i];

                                      v__output.Append(i == 0 ? "" : ",");%&gt;{

                                           "id": "&lt;%= point.BaseName %&gt;",

                "v": &lt;%= point.JsonValue %&gt;,

                "t": &lt;%= point.JsonTimestamp %&gt;,

                "q": &lt;%= (int)point.Quality &gt;= 192? "true":"false" %&gt;

                                    }

                    &lt;% } %&gt;],

                    "timestamp": &lt;%= JTimestamp %&gt;

    }</Text>

            <IsMultiPoint>true</IsMultiPoint>

            <IsDefaultPublishFormat>true</IsDefaultPublishFormat>

          </JsonPublishFormat>

        </PublishFormats>

      </Parser>

    </AdvancedFormatTemplate>


     

  6. Apply the new Template. The “Publish” tab should now contain the script.

     
  7. Verify the data transfer
    • Open View Data to confirm values are being received from the OPC UA server.
    • Verify data is being published to Factbird.
  8. Configure event data (optional)

    If automatic stop causes or other event-driven features are required:

    • Create a second OPC UA connection.
    • Configure the Read Method as Subscription.
    • Create a second MQTT connection.
    • Use the plc/event/<client-id> topic.
    • Configure the separate client certificate and Client ID supplied by Factbird.


  9. Deploy to production
    • Verify the configuration.
    • Configure Cogent DataHub to run as a Windows service.
    • Restart the service if required.

EXPECTED RESULT

After completing these steps:

  • Cogent DataHub is connected to the OPC UA server.
  • Production data is published securely to Factbird using MQTT.
  • Event data is available if configured.
  • Data continues to be transmitted after restarting the Windows service.

TROUBLESHOOTING

Issue: The OPC UA connection test fails.

  • Try: Verify the endpoint URL.

  • Try:Trust the server certificate.
  • Try:Approve the DataHub client certificate on the OPC UA server.

Issue: Data is visible in OPC UA but not in Factbird.

  • Try: Verify the MQTT host, topic, Client ID, and certificate.

  • Try: Confirm Synchronous Cache Read is configured.
  • Try: Ensure Do not send insignificant changes is disabled.

Issue: Changes do not take effect.

  • Try: Click Apply after making configuration changes.

  • Try: Restart Cogent DataHub if required.

STILL NEED HELP?

Contact Support and include:

  • Your Cogent DataHub version.
  • The OPC UA server type.
  • Screenshots of the OPC UA and MQTT configuration.
  • The Event Log.
  • Any connection error messages.

RELATED ARTICLES

 

 

 

Was this article helpful?
0 out of 0 found this helpful