Integrate mRounds with AVEVA PI

mRounds can receive PI event frames, acknowledge them in PI, and write round readings back to PI attributes.

Four separate actions

ActionWho calls whomTopic
Innovapptive polls PI for event framesInnovapptive calls your PI Web API on a schedulePoll AVEVA PI for Event Frames
A customer connector pushes event frames to InnovapptiveYour system calls the Innovapptive webhookReceive AVEVA PI Event Frames by Webhook
Innovapptive acknowledges receipt in PIInnovapptive writes the acknowledgement attributeWrite Acknowledgements and Round Readings to AVEVA PI
Innovapptive writes an operator's round reading to PIInnovapptive writes the measurement attribute mapped to the round taskWrite Acknowledgements and Round Readings to AVEVA PI

Polling and the webhook are alternatives for receiving event frames; most customers use one of them. Both use the event-frame WebId as the unique ID, so a frame delivered twice does not create a second event. The acknowledgement and the round-reading write are separate writes, each to its own attribute.

Four kinds of WebId

PI Web API generates a WebId for every object. These four are not interchangeable:

WebIdIdentifiesExampleUsed for
AF database WebIdThe AF database that holds the event framesF1RDbgZy4oKQ9kiBiZJTW7eugwvgV_Y00GScoping the polling search
Event-frame WebIdOne event frameF1FmbgZy4oKQ9kiBiZJTW7eugwqF…The unique event ID (externalId, item.WebId)
Element WebIdAn AF element, such as Pump-01F1EmbgZy4oKQ9kiBiZJTW7eugwPV…Polled frames return it in RefElementWebIds
Attribute (stream) WebIdOne attribute, such as Acknowledged or BearingTempF1AbEAI8QAAAAAAAAAAAAAAAAAAAAAAATTRTMP01The target of each write. Element and event-frame WebIds cannot be used here.

WebIds in this guide are examples. Your PI Web API generates your own.

Prerequisites

Collect these from the team that owns the PI AF system.

ItemPollingWebhookWriteback
PI Web API base URL, for example https://pi.example-customer.com/piwebapiRequiredRequired
AF asset server and AF database that hold the event frames, and the database WebIdRequired
Account that can search event frames and read their attributes and values in that databaseRequired
Account that can write the acknowledgement attribute and every measurement attribute a round can updateRequired
WebId of the acknowledgement attribute, and the WebId of each measurement attribute a round can updateRequired
HTTPS access from Innovapptive to the PI Web APIRequiredRequired
How the customer system authenticates when calling InnovapptiveRequired
How Innovapptive authenticates when calling the PI Web APIRequiredRequired

The read account and the write account can be the same if your security policy allows it. The credentials your system uses to call Innovapptive are separate from both.

Innovapptive configures the database WebId, polling interval, lookback, acknowledgement attribute and PI credentials for the tenant during onboarding. Send them to your Innovapptive implementation team.

Authentication

The two directions do not share credentials.

Your system to Innovapptive (webhook only). Innovapptive issues the secret during onboarding. Choose one method:

MethodWhat you send
API keyHeader x-api-key: {key we issue}
HMACHeader x-signature: {HMAC-SHA256 hex of the raw request body}, using the shared secret Innovapptive issues
OAuthRequest a token first, then send Authorization: Bearer {token}

OAuth token request, only if you choose OAuth:

POST https://{innovapptive-host}/esis/auth/{yourTenantId}/pi_af
Content-Type: application/json

{
  "clientId": "{client id we issue}",
  "clientSecret": "{client secret we issue}"
}

Innovapptive to your PI Web API (polling reads and both writes).

CallSign-in
Polling readsHTTP Basic
Acknowledgement write and round-reading writeBasic, API key, or none. Both writes use the same choice.
MethodWhat you give InnovapptiveHeader Innovapptive sends
BasicUsername and passwordAuthorization: Basic {base64(username:password)}
API keyThe key, and the header name if it is not x-api-keyThat header. Writes only.
NoneConfirmation that the PI Web API allows the call with no credential on your networkNo credential header. Writes only.

Basic is the usual choice for reads and writes. This is not Windows integrated authentication (Kerberos or NTLM). A Windows account works only if the PI Web API accepts it as a Basic username and password; it does not have to be the account the PI services run under. Reads and writes also send Accept: application/json.

PI Web API paths to allow

Allow HTTPS from Innovapptive to these paths and grant the matching permission.

MethodPathWhenPermission
GET/piwebapi/eventframes/searchEvery pollRead event frames in the AF database
GET/piwebapi/eventframes/{eventFrameWebId}/attributesOnce per frame foundRead event-frame attributes
GET/piwebapi/streamsets/{eventFrameWebId}/valueOnce per frame foundRead attribute values
POST/piwebapi/streams/{attributeWebId}/valueEach acknowledgement and each round readingWrite the designated attributes