CreateMeteringPointUpdate@1
Node CreateMeteringPointUpdate@1 compares a metering point reported by EDA with the metering point entities that already exist in the runtime and decides whether a new metering point has to be created or which existing entity has to be updated. The result is a list of MeteringPointUpdateInfo objects that a subsequent CreateUpdateInfo@1 uses to build the actual entity updates.
Adapter Prerequisites
Node Configuration
For fields path, targetPath, targetValueWriteMode, and targetValueKind, see Overview.
transformations:
- type: CreateMeteringPointUpdate@1
path: $.key # metering point reported by EDA (MeteringPointInfo)
consumerPath: $.key.Consumer[0] # existing consumer metering point entity, if any
producerPath: $.key.Producer[0] # existing producer metering point entity, if any
edaMeteringPointPath: $.key.EdaMeteringPoint[0] # optional: existing EDA metering point entity
targetPath: $.meteringPointUpdates
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
path | string | No | $ | Path to the metering point reported by EDA (MeteringPointInfo, e.g. an entry of EdaMessageInfo.MeteringPoints) |
consumerPath | string | Yes | - | Path to the existing consumer metering point entity; may resolve to nothing |
producerPath | string | Yes | - | Path to the existing producer metering point entity; may resolve to nothing |
edaMeteringPointPath | string | No | - | Path to an existing EDA metering point entity |
targetPath | string | No | $ | Path where the list of MeteringPointUpdateInfo objects is written |
Behavior
If no metering point is found at path, the node writes nothing. Otherwise IsActive is set to true if ActivatedSince is today or earlier and DeactivatedSince is not set. Then:
| Situation | Result |
|---|---|
| No consumer, producer or EDA metering point exists | One entry without RtId: the metering point has to be created |
| Direction consumption, consumer exists | One entry with the RtId of the consumer |
| Direction consumption, only a producer exists | One entry with the RtId of the producer and HasWrongType: true |
| Direction production, producer exists | One entry with the RtId of the producer; a production type already stored on the producer (second value of the query row, Values[1]) is kept |
| Direction production, only a consumer exists | One entry with the RtId of the consumer and HasWrongType: true |
| Any other case (e.g. direction unknown, or only an EDA metering point exists) | An empty list |
The existing entities are read as JSON objects; the node only uses their RtId (and Values[1] of the producer).
Output
A list of MeteringPointUpdateInfo objects. They contain all properties of MeteringPointInfo (see CreateMeteringPointData@1) plus:
| Property | Description |
|---|---|
RtId | RtId of the existing entity to update, null for a new metering point |
IsActive | true if ActivatedSince is today or earlier and DeactivatedSince is not set; a future deactivation date gives false |
HasWrongType | true if the existing entity has the other energy direction |
The configuration properties are documented in the API reference.
Complete sample of pipeline configuration
This sample takes the metering points of parsed ECMPList messages, joins the existing consumer and producer entities and creates one update decision per metering point.
triggers:
- type: FromPipelineDataEvent@1
transformations:
- type: Flatten@1
path: $.EdaMessages[*].MeteringPoints[*]
targetPath: $.MeteringPoints
- type: Join@1
path: $.MeteringPoints[*]
keyPath: $.MeteringPointNumber
joinPath: $.consumers.Rows[*] # query result with the existing consumer metering points
joinKeyPath: $.Values[0]
itemPath: $.Consumer
- type: Join@1
path: $.MeteringPoints[*]
keyPath: $.MeteringPointNumber
joinPath: $.producers.Rows[*] # query result with the existing producer metering points
joinKeyPath: $.Values[0]
itemPath: $.Producer
- type: ForEach@1
iterationPath: $.MeteringPoints
mergePath: $.update
targetPath: $.MeteringPointUpdates
transformations:
- type: CreateMeteringPointUpdate@1
path: $.key
consumerPath: $.key.Consumer[0]
producerPath: $.key.Producer[0]
targetPath: $.update