Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
6821c09
Add Distro Energy GOPACS Connector API client
Miggets7 Oct 22, 2026
05a1305
Add GOPACS order attributes to EmsDistroEnergyAsset
Miggets7 Oct 22, 2026
836b67a
Add Distro GOPACS order handler
Miggets7 Oct 22, 2026
09cabc7
Run the Distro GOPACS handler from the EMS service
Miggets7 Oct 22, 2026
3a21e24
Test the Distro GOPACS order handler
Miggets7 Oct 22, 2026
835b326
Document Distro GOPACS orders
Miggets7 Oct 22, 2026
4ad00e9
Address review of the Distro GOPACS order handler
Miggets7 Oct 22, 2026
79d1166
Show the Distro GOPACS panels in the right column
Miggets7 Oct 28, 2026
a2d0f43
Move the Distro GOPACS announcement and order panels left
Miggets7 Oct 28, 2026
64a76fa
Cancel open Distro GOPACS orders when the handler stops for good
Miggets7 Oct 28, 2026
73f2d75
Refuse Distro GOPACS orders the updated API would reject
Miggets7 Oct 28, 2026
9434b9e
Refuse a Distro GOPACS order after the bid validity end
Miggets7 Oct 28, 2026
0cd8dfe
Stop tracking a settled Distro GOPACS order when its trades fail to load
Miggets7 Oct 28, 2026
80e71d5
Move Distro GOPACS order copies into the DTO
Miggets7 Oct 28, 2026
50a0a54
Route only the Distro GOPACS order inputs to the handler
Miggets7 Oct 28, 2026
636400a
Shorten the Distro GOPACS suggestion logging
Miggets7 Oct 28, 2026
663ebd2
Reset Distro GOPACS flags left true when the handler deploys
Miggets7 Oct 28, 2026
48df814
Log what the Distro GOPACS handler does with each input
Miggets7 Oct 28, 2026
a38fd2e
Log the error body Distro sends with a failed GOPACS call
Miggets7 Oct 28, 2026
ca6eae1
Make the Distro GOPACS order type a BUY/SELL dropdown
Miggets7 Oct 28, 2026
7b12e52
Pull the Distro GOPACS order checks into validateInput
Miggets7 Oct 28, 2026
6a9fc83
Let OpenRemote reject a negative Distro GOPACS price
Miggets7 Oct 28, 2026
6e5be5c
Format the Distro GOPACS tests with Spotless
Miggets7 Oct 28, 2026
966b444
Describe Distro GOPACS settlements as Distro confirmed them
Miggets7 Oct 28, 2026
43a3fc8
Copy the GOPACS announcement to sibling Distro assets
Miggets7 Oct 28, 2026
59c85be
Document the copied GOPACS announcement inputs
Miggets7 Oct 28, 2026
bf2d779
Place Distro GOPACS orders under the asset's portfolio
Miggets7 Nov 3, 2026
84bcc74
Rename the GOPACS and Distro panel titles
Miggets7 Nov 4, 2026
6d16fe7
Track the Distro GOPACS order statuses of the 4 Nov spec
Miggets7 Nov 4, 2026
0cb1d53
Restart the Distro GOPACS handler when the portfolio changes
Miggets7 Nov 4, 2026
03adab2
Merge remote-tracking branch 'origin/main' into feature/distro-gopacs…
Miggets7 Nov 4, 2026
a9100ef
Format the Distro GOPACS test with Spotless 8.10.4
Miggets7 Nov 4, 2026
fcaf1da
Read Distro GOPACS settlements per order reference
Miggets7 Nov 5, 2026
3e085a3
Strip the GOPACS ean. prefix before sending an EAN to Distro
Miggets7 Nov 11, 2026
053ae10
Size the GOPACS order quantity per battery before summing
Miggets7 Nov 11, 2026
1489977
Record a settled order's trades as one data point
Miggets7 Nov 11, 2026
9c8da89
Retry fetching the trades of a settled GOPACS order
Miggets7 Nov 11, 2026
ba673c2
Record the trades of GOPACS orders that end unsettled
Miggets7 Nov 11, 2026
13c2bfd
Retry GOPACS order cancels that fail in transit
Miggets7 Nov 11, 2026
40bdff0
Harden the Distro GOPACS cancel and settlement retries
Miggets7 Nov 11, 2026
a2cc452
Leave the saved Distro GOPACS orders alone when there is nothing to c…
Miggets7 Nov 11, 2026
02b3079
Replace GOPACS orders at the asset's current price
Miggets7 Nov 11, 2026
210fd92
Pre-fill the GOPACS order when the handler starts
Miggets7 Nov 11, 2026
6a182a2
Retry GOPACS order cancels the operator asked for
Miggets7 Nov 11, 2026
7d5201b
Copy GOPACS announcement inputs only from a lone GOPACS asset
Miggets7 Nov 11, 2026
1ec05d5
Bring the Distro GOPACS guide in line with the order handler
Miggets7 Nov 11, 2026
29d1493
Apply GOPACS price changes to orders that become replaceable later
Miggets7 Nov 11, 2026
0f4e8fe
Keep polling Distro GOPACS orders after a failed poll
Miggets7 Nov 11, 2026
d21b670
Adopt untracked Distro GOPACS orders on the first poll
Miggets7 Nov 11, 2026
e510a00
Add the GOPACS order attributes to existing Distro assets
Miggets7 Nov 11, 2026
03cdd3b
Document that one manager serves one Distro customer
Miggets7 Nov 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
218 changes: 215 additions & 3 deletions ems/docs/DistroEnergyIntegration.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ems/docs/GopacsIntegration.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ are read-only.
| Announcement | `redispatchEndTime` | Timestamp | - | ✓ | End of the problem period. |
| Announcement | `redispatchBidValidityEnd` | Timestamp | - | ✓ | Latest moment a bid can still be submitted for this announcement. |
| Announcement | `redispatchRequestedPower` | Number | kW | ✓ | Remaining problem profile, written as predicted data points (15-min ISP grid, 7-day retention). |
| Announcement | `redispatchEanEffectivity` | Text | - | ✓ | Effectivity category in which the contracted EAN was matched (e.g. `THREE_PHASE_NETWORK_REDUCE`). |
| Announcement | `redispatchEanEffectivity` | Text | - | ✓ | Effectivity category in which the contracted EAN was matched (e.g. `BUY_LOW_SELL_HIGH`). |
| Announcement | `redispatchRequestAreaBuy` | Text | - | ✓ | DSO-supplied area description for buy orders. |
| Announcement | `redispatchRequestAreaSell` | Text | - | ✓ | DSO-supplied area description for sell orders. |
| Announcement | `redispatchLastPoll` | timestamp | - | ✓ | Timestamp of the last completed poll cycle (only updated when the API responded). |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,18 @@
*/
package org.openremote.extension.ems.agent;

import static org.openremote.model.Constants.*;

import jakarta.persistence.Entity;
import java.util.Optional;
import org.openremote.model.asset.Asset;
import org.openremote.model.asset.AssetDescriptor;
import org.openremote.model.attribute.MetaItem;
import org.openremote.model.value.AttributeDescriptor;
import org.openremote.model.value.MetaItemType;
import org.openremote.model.value.ValueDescriptor;
import org.openremote.model.value.ValueType;
import org.openremote.model.value.ValueType.ObjectMap;

@Entity
public class EmsDistroEnergyAsset extends Asset<EmsDistroEnergyAsset> {
Expand All @@ -43,6 +47,97 @@ public class EmsDistroEnergyAsset extends Asset<EmsDistroEnergyAsset> {
new AttributeDescriptor<>(
"daysSubmitted", ValueType.POSITIVE_INTEGER, new MetaItem<>(MetaItemType.READ_ONLY));

// --- GOPACS orders: configuration ---

public static final AttributeDescriptor<Boolean> GOPACS_ENABLED =
new AttributeDescriptor<>("gopacsEnabled", ValueType.BOOLEAN);

// --- GOPACS orders: announcement inputs, copied from the EmsGOPACSAsset with the same parent ---

public static final AttributeDescriptor<String> GOPACS_EAN =
new AttributeDescriptor<>(
"gopacsEan", ValueType.TEXT, new MetaItem<>(MetaItemType.READ_ONLY));

public static final AttributeDescriptor<String> GOPACS_ANNOUNCEMENT_ID =
new AttributeDescriptor<>(
"gopacsAnnouncementId", ValueType.TEXT, new MetaItem<>(MetaItemType.READ_ONLY));

public static final AttributeDescriptor<Long> GOPACS_START_TIME =
new AttributeDescriptor<>(
"gopacsStartTime", ValueType.TIMESTAMP, new MetaItem<>(MetaItemType.READ_ONLY));

public static final AttributeDescriptor<Long> GOPACS_END_TIME =
new AttributeDescriptor<>(
"gopacsEndTime", ValueType.TIMESTAMP, new MetaItem<>(MetaItemType.READ_ONLY));

public static final AttributeDescriptor<Long> GOPACS_BID_VALIDITY_END =
new AttributeDescriptor<>(
"gopacsBidValidityEnd", ValueType.TIMESTAMP, new MetaItem<>(MetaItemType.READ_ONLY));

public static final AttributeDescriptor<String> GOPACS_EAN_EFFECTIVITY =
new AttributeDescriptor<>(
"gopacsEanEffectivity", ValueType.TEXT, new MetaItem<>(MetaItemType.READ_ONLY));

// --- GOPACS orders: next order, pre-filled by the handler and operator-overridable ---

public enum GopacsOrderTypeValueType {
BUY,
SELL
}

public static final ValueDescriptor<GopacsOrderTypeValueType> GOPACS_ORDER_TYPE_VALUE_TYPE =
new ValueDescriptor<>("gopacsOrderTypeValueType", GopacsOrderTypeValueType.class);

public static final AttributeDescriptor<GopacsOrderTypeValueType> GOPACS_ORDER_TYPE =
new AttributeDescriptor<>("gopacsOrderType", GOPACS_ORDER_TYPE_VALUE_TYPE);

public static final AttributeDescriptor<Double> GOPACS_ORDER_QUANTITY =
new AttributeDescriptor<>("gopacsOrderQuantity", ValueType.NUMBER)
.withUnits(UNITS_KILO, UNITS_WATT);

public static final AttributeDescriptor<Double> GOPACS_ORDER_PRICE =
new AttributeDescriptor<>("gopacsOrderPrice", ValueType.POSITIVE_NUMBER)
.withUnits("EUR", UNITS_PER, UNITS_MEGA, UNITS_WATT, UNITS_HOUR);

// --- GOPACS orders: operator actions, reset by the handler ---

public static final AttributeDescriptor<Boolean> GOPACS_CONFIRM_ORDER =
new AttributeDescriptor<>("gopacsConfirmOrder", ValueType.BOOLEAN);

public static final AttributeDescriptor<Boolean> GOPACS_CANCEL_ORDERS =
new AttributeDescriptor<>("gopacsCancelOrders", ValueType.BOOLEAN);

// --- GOPACS orders: status ---

/**
* Orders still being tracked, keyed by reference. Final orders drop out once their trades are
* recorded.
*/
public static final AttributeDescriptor<ObjectMap> GOPACS_ORDERS =
new AttributeDescriptor<>(
"gopacsOrders", ValueType.JSON_OBJECT, new MetaItem<>(MetaItemType.READ_ONLY));

/** One data point per order action and status change. */
public static final AttributeDescriptor<ObjectMap> GOPACS_ORDER_HISTORY =
new AttributeDescriptor<>(
"gopacsOrderHistory",
ValueType.JSON_OBJECT,
new MetaItem<>(MetaItemType.READ_ONLY),
new MetaItem<>(MetaItemType.STORE_DATA_POINTS));

/** One data point per order with trades: its reference and all of its trades. */
public static final AttributeDescriptor<ObjectMap> GOPACS_SETTLEMENT_HISTORY =
new AttributeDescriptor<>(
"gopacsSettlementHistory",
ValueType.JSON_OBJECT,
new MetaItem<>(MetaItemType.READ_ONLY),
new MetaItem<>(MetaItemType.STORE_DATA_POINTS));

/** When the tracked orders were last synced with Distro. */
public static final AttributeDescriptor<Long> GOPACS_LAST_SYNC =
new AttributeDescriptor<>(
"gopacsLastSync", ValueType.TIMESTAMP, new MetaItem<>(MetaItemType.READ_ONLY));

public static final AssetDescriptor<EmsDistroEnergyAsset> DESCRIPTOR =
new AssetDescriptor<>("transmission-tower", null, EmsDistroEnergyAsset.class);

Expand All @@ -59,4 +154,62 @@ public Optional<String> getPortfolio() {
public void setPortfolio(String portfolio) {
getAttributes().getOrCreate(PORTFOLIO).setValue(portfolio);
}

// --- GOPACS getters ---

public Optional<Boolean> getGopacsEnabled() {
return getAttributes().getValue(GOPACS_ENABLED);
}

public Optional<String> getGopacsEan() {
return getAttributes().getValue(GOPACS_EAN);
}

public Optional<String> getGopacsAnnouncementId() {
return getAttributes().getValue(GOPACS_ANNOUNCEMENT_ID);
}

public Optional<Long> getGopacsStartTime() {
return getAttributes().getValue(GOPACS_START_TIME);
}

public Optional<Long> getGopacsEndTime() {
return getAttributes().getValue(GOPACS_END_TIME);
}

public Optional<Long> getGopacsBidValidityEnd() {
return getAttributes().getValue(GOPACS_BID_VALIDITY_END);
}

public Optional<String> getGopacsEanEffectivity() {
return getAttributes().getValue(GOPACS_EAN_EFFECTIVITY);
}

public Optional<GopacsOrderTypeValueType> getGopacsOrderType() {
return getAttributes().getValue(GOPACS_ORDER_TYPE);
}

public Optional<Double> getGopacsOrderQuantity() {
return getAttributes().getValue(GOPACS_ORDER_QUANTITY);
}

public Optional<Double> getGopacsOrderPrice() {
return getAttributes().getValue(GOPACS_ORDER_PRICE);
}

public Optional<ObjectMap> getGopacsOrders() {
return getAttributes().getValue(GOPACS_ORDERS);
}

// --- GOPACS setters ---

public EmsDistroEnergyAsset setGopacsEnabled(Boolean enabled) {
getAttributes().getOrCreate(GOPACS_ENABLED).setValue(enabled);
return this;
}

public EmsDistroEnergyAsset setGopacsOrderPrice(Double price) {
getAttributes().getOrCreate(GOPACS_ORDER_PRICE).setValue(price);
return this;
}
}
Loading
Loading