# Integration options

Source: https://cumulocity.com/docs/historian-integration/integration-methods/
Release: Latest

Use the OPC UA device gateway for historians that provide an OPC UA server interface, and the AVEVA PI connector for AVEVA PI System. For an overview of the supported historians and their respective integrations, see [Supported historians](https://cumulocity.com/docs/historian-integration/supported-historians/).


## Integration via the OPC UA device gateway

Many historians provide an OPC UA server, either natively or as an optional module. You can connect such historians to Cumulocity with the [OPC UA device gateway](https://cumulocity.com/docs/device-integration/opcua/), in the same way as any other OPC UA server.

To integrate a historian via OPC UA:

1. Enable the OPC UA server interface of your historian. For details, refer to the documentation of your historian vendor.
2. Install the OPC UA device gateway in your environment. We recommend running it in thin-edge.io mode, in which the gateway registers automatically as a child device of the thin-edge.io device and uses the thin-edge.io proxy to communicate with Cumulocity. For details, see [Gateway configuration and registration](https://cumulocity.com/docs/device-integration/opcua/#gateway-configuration-and-registration).
3. In the **OPC UA server** tab of the gateway, click **Add server** and enter the endpoint URL of the historian's OPC UA server. For details, see [Connecting the gateway to the server](https://cumulocity.com/docs/device-integration/opcua/#connecting-gateway).
4. Create a device protocol that maps the historian tags to Cumulocity measurements, events, or alarms. For details, see [Device protocols](https://cumulocity.com/docs/device-integration/opcua/#device-protocols) and [Data mapping](https://cumulocity.com/docs/historian-integration/data-mapping/#opcua-device-gateway).


> **Important:**
> Historians can expose a very large number of tags. Set the address scan type to "partial" and scan only the node IDs you want to integrate. A full scan of a large historian address space can take from hours to days.



Some historians only provide the classic OPC Data Access (DA) or Historical Data Access (HDA) interfaces. You can integrate these historians with a third-party OPC DA/HDA to OPC UA wrapper, which exposes the classic interface as an OPC UA server.

## Integration via the AVEVA PI connector

AVEVA PI System uses a proprietary interface by default. For AVEVA PI, Cumulocity provides a dedicated connector that reads tag values from the PI Web API and forwards them to Cumulocity.

The connector runs as a container next to [thin-edge.io](https://thin-edge.io/) on a Linux edge device or virtual machine. thin-edge.io handles the communication with Cumulocity, so you can install, update, and configure the connector remotely in the **Software** and **Configuration** tabs of the device in the Device Management application.

The AVEVA PI connector requires:

* A PI System with PI Web API installed.
* A PI user with at least read permission.
* A thin-edge.io instance with the container plugin installed, connected to Cumulocity.
* Network connectivity from the device to the PI Web API endpoint.

You define the PI tags to collect and the polling interval in configuration files, which you upload to the device in the **Configuration** tab. The connector applies changes without a restart. For the full setup, see the [AVEVA PI connector repository](https://github.com/Cumulocity-IoT/thin-edge-aveva-pi-connector).


> **Info:**
> - If your AVEVA PI System has the PI Connector for OPC UA or another OPC UA interface available, you can integrate it via the [OPC UA device gateway](https://cumulocity.com/docs/historian-integration/integration-methods/#opcua-device-gateway) instead.
> - The AVEVA PI connector is an open-source component, published under the MIT license. Its source code is available in the [AVEVA PI connector repository](https://github.com/Cumulocity-IoT/thin-edge-aveva-pi-connector) on GitHub, so you can review it and adapt it to your requirements.
