Skip to content

Commit 8545fc6

Browse files
committed
feat: support assets api 0.3
Signed-off-by: Richard Sandoval <rsandovaldev@gmail.com>
1 parent 4cc4cea commit 8545fc6

39 files changed

Lines changed: 1859 additions & 17 deletions

RELEASE_NOTES.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@
1515

1616
<!-- Here goes the main new features and examples or instructions on how to use them -->
1717

18+
* Added client methods for the new `platformassets.v1alpha1` RPCs:
19+
`list_gridpools()`, `list_gridpool_energy_schedules()`,
20+
`list_market_topology_relations()`, `list_microgrids()`, and
21+
`list_microgrid_sensors()`.
22+
* Added `component_ids` and `categories` filters to
23+
`list_microgrid_electrical_components()`.
24+
1825
## Bug Fixes
1926

2027
<!-- Here goes notable bug fixes that are worth a special mention or explanation -->

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ dependencies = [
4040
"frequenz-api-assets >= 0.3.0, < 0.4.0",
4141
"frequenz-api-common >= 0.8.9, < 1",
4242
"frequenz-client-base >= 0.11.0, < 0.12.0",
43-
"frequenz-client-common >= 0.3.6, < 0.4.0",
44-
"grpcio >= 1.80.0, < 2",
43+
"frequenz-client-common >= 0.3.8, < 0.4.0",
44+
"grpcio >= 1.81.0, < 2",
4545
]
4646
dynamic = ["version"]
4747

src/frequenz/client/assets/__init__.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,48 @@
33

44
"""Assets API client."""
55

6+
from ._balancing_group import BalancingGroup
67
from ._client import AssetsApiClient
78
from ._delivery_area import DeliveryArea, EnergyMarketCodeType
9+
from ._gridpool import Gridpool
10+
from ._gridpool_energy_schedule import (
11+
DeliveryDuration,
12+
GridpoolEnergySchedule,
13+
GridpoolEnergyScheduleDirection,
14+
GridpoolEnergyScheduleTimeSeriesEntry,
15+
)
16+
from ._interval import Interval
817
from ._lifetime import Lifetime
918
from ._location import Location
19+
from ._market_location import MarketLocation, MarketLocationId, MarketLocationIdType
20+
from ._market_topology import (
21+
MarketParticipation,
22+
MarketParticipationType,
23+
MarketTopologyRelation,
24+
)
1025
from ._microgrid import Microgrid, MicrogridStatus
26+
from ._sensor import Sensor
1127

1228
__all__ = [
1329
"AssetsApiClient",
30+
"BalancingGroup",
1431
"DeliveryArea",
32+
"DeliveryDuration",
1533
"EnergyMarketCodeType",
34+
"Gridpool",
35+
"GridpoolEnergySchedule",
36+
"GridpoolEnergyScheduleDirection",
37+
"GridpoolEnergyScheduleTimeSeriesEntry",
38+
"Interval",
1639
"Microgrid",
1740
"MicrogridStatus",
1841
"Location",
1942
"Lifetime",
43+
"MarketLocation",
44+
"MarketLocationId",
45+
"MarketLocationIdType",
46+
"MarketParticipation",
47+
"MarketParticipationType",
48+
"MarketTopologyRelation",
49+
"Sensor",
2050
]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# License: MIT
2+
# Copyright © 2026 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Balancing group definitions."""
5+
6+
from dataclasses import dataclass
7+
8+
from ._delivery_area import EnergyMarketCodeType
9+
10+
11+
@dataclass(frozen=True, kw_only=True)
12+
class BalancingGroup:
13+
"""A market balancing group identified by its market code."""
14+
15+
code: str | None
16+
"""The balancing group code."""
17+
18+
code_type: EnergyMarketCodeType | int
19+
"""The type of market code used to identify the balancing group."""
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# License: MIT
2+
# Copyright © 2026 Frequenz Energy-as-a-Service GmbH
3+
4+
"""Conversion of BalancingGroup objects from protobuf messages."""
5+
6+
from frequenz.api.common.v1alpha8.grid import balancing_group_pb2
7+
from frequenz.client.common.proto import enum_from_proto
8+
9+
from ._balancing_group import BalancingGroup
10+
from ._delivery_area import EnergyMarketCodeType
11+
12+
13+
def balancing_group_from_proto(
14+
message: balancing_group_pb2.BalancingGroup,
15+
) -> BalancingGroup:
16+
"""Convert a protobuf balancing group message to a balancing group object."""
17+
return BalancingGroup(
18+
code=message.code or None,
19+
code_type=enum_from_proto(message.code_type, EnergyMarketCodeType),
20+
)

0 commit comments

Comments
 (0)