frequenz-client-microgrid 0.9.0__tar.gz → 0.18.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/PKG-INFO +31 -30
- frequenz_client_microgrid-0.18.0/RELEASE_NOTES.md +215 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/pyproject.toml +34 -29
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz/client/microgrid/__init__.py +15 -58
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_client.py +709 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_delivery_area.py +89 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_delivery_area_proto.py +44 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz/client/microgrid/_lifetime.py +3 -1
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_lifetime_proto.py +26 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_location.py +31 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_location_proto.py +47 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_microgrid_info.py +87 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/_microgrid_info_proto.py +79 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/__init__.py +110 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_battery.py +131 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_category.py +106 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_chp.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_component.py +120 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_component_proto.py +538 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_connection.py +72 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_connection_proto.py +106 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_converter.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_crypto_miner.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_data_samples.py +25 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_data_samples_proto.py +90 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_electrolyzer.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_ev_charger.py +155 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_grid_connection_point.py +61 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_hvac.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_inverter.py +155 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_meter.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_precharger.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_problematic.py +50 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_relay.py +18 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_state_sample.py +320 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_state_sample_proto.py +42 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_types.py +63 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/component/_voltage_transformer.py +43 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/metrics/__init__.py +16 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/metrics/_bounds.py +45 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/metrics/_bounds_proto.py +17 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/metrics/_metric.py +613 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/metrics/_sample.py +174 -0
- frequenz_client_microgrid-0.18.0/src/frequenz/client/microgrid/metrics/_sample_proto.py +111 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz_client_microgrid.egg-info/PKG-INFO +31 -30
- frequenz_client_microgrid-0.18.0/src/frequenz_client_microgrid.egg-info/SOURCES.txt +55 -0
- frequenz_client_microgrid-0.18.0/src/frequenz_client_microgrid.egg-info/requires.txt +57 -0
- frequenz_client_microgrid-0.9.0/RELEASE_NOTES.md +0 -14
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_client.py +0 -675
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_component.py +0 -264
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_component_data.py +0 -595
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_component_error.py +0 -213
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_component_states.py +0 -253
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_connection.py +0 -29
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_constants.py +0 -21
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_metadata.py +0 -53
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/_sensor_proto.py +0 -190
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/metrics.py +0 -61
- frequenz_client_microgrid-0.9.0/src/frequenz/client/microgrid/sensor.py +0 -234
- frequenz_client_microgrid-0.9.0/src/frequenz_client_microgrid.egg-info/SOURCES.txt +0 -27
- frequenz_client_microgrid-0.9.0/src/frequenz_client_microgrid.egg-info/requires.txt +0 -56
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/LICENSE +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/MANIFEST.in +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/README.md +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/setup.cfg +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz/client/microgrid/_exception.py +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz/client/microgrid/_util.py +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz/client/microgrid/conftest.py +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz/client/microgrid/py.typed +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz_client_microgrid.egg-info/dependency_links.txt +0 -0
- {frequenz_client_microgrid-0.9.0 → frequenz_client_microgrid-0.18.0}/src/frequenz_client_microgrid.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: frequenz-client-microgrid
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.18.0
|
|
4
4
|
Summary: Microgrid API client for Python
|
|
5
5
|
Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
|
|
6
6
|
License: MIT
|
|
@@ -21,52 +21,53 @@ Classifier: Typing :: Typed
|
|
|
21
21
|
Requires-Python: <4,>=3.11
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
License-File: LICENSE
|
|
24
|
-
Requires-Dist: frequenz-api-
|
|
25
|
-
Requires-Dist: frequenz-
|
|
26
|
-
Requires-Dist: frequenz-
|
|
27
|
-
Requires-Dist: frequenz-client-
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
24
|
+
Requires-Dist: frequenz-api-common<1.0.0,>=0.8.0
|
|
25
|
+
Requires-Dist: frequenz-api-microgrid<0.19.0,>=0.18.0
|
|
26
|
+
Requires-Dist: frequenz-channels<2.0.0,>=1.6.1
|
|
27
|
+
Requires-Dist: frequenz-client-base<0.12.0,>=0.10.0
|
|
28
|
+
Requires-Dist: frequenz-client-common<0.4.0,>=0.3.6
|
|
29
|
+
Requires-Dist: frequenz-core<2.0.0,>=1.3.0
|
|
30
|
+
Requires-Dist: grpcio<2,>=1.72.1
|
|
31
|
+
Requires-Dist: protobuf<7,>=6.31.1
|
|
31
32
|
Requires-Dist: typing-extensions<5,>=4.13.0
|
|
32
33
|
Provides-Extra: dev-flake8
|
|
33
|
-
Requires-Dist: flake8==7.
|
|
34
|
+
Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
|
|
34
35
|
Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
|
|
35
36
|
Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
|
|
36
|
-
Requires-Dist: pydoclint==0.
|
|
37
|
+
Requires-Dist: pydoclint==0.7.6; extra == "dev-flake8"
|
|
37
38
|
Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
|
|
38
39
|
Provides-Extra: dev-formatting
|
|
39
|
-
Requires-Dist: black==25.
|
|
40
|
-
Requires-Dist: isort==6.0
|
|
40
|
+
Requires-Dist: black==25.9.0; extra == "dev-formatting"
|
|
41
|
+
Requires-Dist: isort==6.1.0; extra == "dev-formatting"
|
|
41
42
|
Provides-Extra: dev-mkdocs
|
|
42
|
-
Requires-Dist: black==25.
|
|
43
|
-
Requires-Dist: Markdown==3.
|
|
43
|
+
Requires-Dist: black==25.9.0; extra == "dev-mkdocs"
|
|
44
|
+
Requires-Dist: Markdown==3.9; extra == "dev-mkdocs"
|
|
44
45
|
Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
|
|
45
46
|
Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
|
|
46
47
|
Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
|
|
47
|
-
Requires-Dist: mkdocs-macros-plugin==1.
|
|
48
|
-
Requires-Dist: mkdocs-material==9.6.
|
|
49
|
-
Requires-Dist: mkdocstrings[python]==0.
|
|
50
|
-
Requires-Dist: mkdocstrings-python==1.
|
|
51
|
-
Requires-Dist: frequenz-repo-config[lib]==0.13.
|
|
48
|
+
Requires-Dist: mkdocs-macros-plugin==1.4.1; extra == "dev-mkdocs"
|
|
49
|
+
Requires-Dist: mkdocs-material==9.6.22; extra == "dev-mkdocs"
|
|
50
|
+
Requires-Dist: mkdocstrings[python]==0.30.1; extra == "dev-mkdocs"
|
|
51
|
+
Requires-Dist: mkdocstrings-python==1.18.2; extra == "dev-mkdocs"
|
|
52
|
+
Requires-Dist: frequenz-repo-config[lib]==0.13.6; extra == "dev-mkdocs"
|
|
52
53
|
Provides-Extra: dev-mypy
|
|
53
|
-
Requires-Dist: mypy==1.
|
|
54
|
+
Requires-Dist: mypy==1.18.2; extra == "dev-mypy"
|
|
54
55
|
Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
|
|
55
|
-
Requires-Dist: types-Markdown==3.
|
|
56
|
-
Requires-Dist: types-protobuf==6.
|
|
56
|
+
Requires-Dist: types-Markdown==3.9.0.20250906; extra == "dev-mypy"
|
|
57
|
+
Requires-Dist: types-protobuf==6.32.1.20250918; extra == "dev-mypy"
|
|
57
58
|
Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
|
|
58
59
|
Provides-Extra: dev-noxfile
|
|
59
|
-
Requires-Dist: nox==2025.
|
|
60
|
-
Requires-Dist: frequenz-repo-config[lib]==0.13.
|
|
60
|
+
Requires-Dist: nox==2025.10.16; extra == "dev-noxfile"
|
|
61
|
+
Requires-Dist: frequenz-repo-config[lib]==0.13.6; extra == "dev-noxfile"
|
|
61
62
|
Provides-Extra: dev-pylint
|
|
62
|
-
Requires-Dist: pylint==
|
|
63
|
+
Requires-Dist: pylint==4.0.2; extra == "dev-pylint"
|
|
63
64
|
Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
|
|
64
65
|
Provides-Extra: dev-pytest
|
|
65
|
-
Requires-Dist: pytest==8.
|
|
66
|
-
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.
|
|
67
|
-
Requires-Dist: pytest-mock==3.
|
|
68
|
-
Requires-Dist: pytest-asyncio==
|
|
69
|
-
Requires-Dist: async-solipsism==0.
|
|
66
|
+
Requires-Dist: pytest==8.4.2; extra == "dev-pytest"
|
|
67
|
+
Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.6; extra == "dev-pytest"
|
|
68
|
+
Requires-Dist: pytest-mock==3.15.1; extra == "dev-pytest"
|
|
69
|
+
Requires-Dist: pytest-asyncio==1.2.0; extra == "dev-pytest"
|
|
70
|
+
Requires-Dist: async-solipsism==0.8; extra == "dev-pytest"
|
|
70
71
|
Provides-Extra: dev
|
|
71
72
|
Requires-Dist: frequenz-client-microgrid[dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]; extra == "dev"
|
|
72
73
|
Dynamic: license-file
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Frequenz Microgrid API Client Release Notes
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
This release is a major breaking change. The client now targets the Microgrid API specification version `0.18.x` and the `v1` namespace in `frequenz-api-common`. Both upstream projects introduce large structural and naming changes to components, metrics, and telemetry, and this client has been refactored accordingly.
|
|
6
|
+
|
|
7
|
+
Existing code written for `frequenz-client-microgrid` `v0.9.1` will not work without changes. Upgrading will typically require:
|
|
8
|
+
|
|
9
|
+
- Bumping dependencies to the new API and common libraries.
|
|
10
|
+
- Updating imports for components, metrics, and IDs.
|
|
11
|
+
- Migrating from the old ad-hoc component and sensor APIs to the new component/metrics model.
|
|
12
|
+
- Adapting to the new power-control and bounds APIs.
|
|
13
|
+
|
|
14
|
+
For a full overview of upstream changes, consult the [Microgrid API releases](https://github.com/frequenz-floss/frequenz-api-microgrid/releases) and [Common API releases](https://github.com/frequenz-floss/frequenz-api-common/releases).
|
|
15
|
+
|
|
16
|
+
## Upgrading
|
|
17
|
+
|
|
18
|
+
The following notes are aimed at users upgrading from `frequenz-client-microgrid` `v0.9.1`.
|
|
19
|
+
|
|
20
|
+
### Dependencies and imports
|
|
21
|
+
|
|
22
|
+
- **Dependencies**:
|
|
23
|
+
|
|
24
|
+
- `frequenz-api-microgrid` is now required at `>= 0.18.0, < 0.19.0`.
|
|
25
|
+
- `frequenz-api-common` is now required at `>= 0.8.0, < 1.0.0` and uses the `v1` namespace.
|
|
26
|
+
- `frequenz-client-common` is now required at `>= 0.3.6, < 0.4.0` and provides ID and helper types used throughout the client.
|
|
27
|
+
|
|
28
|
+
Make sure you pin compatible versions in your own project when upgrading.
|
|
29
|
+
|
|
30
|
+
- **IDs and common types**:
|
|
31
|
+
|
|
32
|
+
IDs come from `frequenz.client.common` (this was already true in `v0.9.1`, but they are now used more consistently):
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from frequenz.client.common.microgrid import MicrogridId
|
|
36
|
+
from frequenz.client.common.microgrid.components import ComponentId
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- **Components and metrics**:
|
|
40
|
+
|
|
41
|
+
The old component and data types (`Component`, `ComponentCategory`, `BatteryData`, `InverterData`, `ComponentState*`, etc.) that used to live directly under `frequenz.client.microgrid` have been replaced with a richer component and metrics model:
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from frequenz.client.microgrid import MicrogridApiClient
|
|
45
|
+
from frequenz.client.microgrid import component, metrics
|
|
46
|
+
|
|
47
|
+
# Example component types
|
|
48
|
+
from frequenz.client.microgrid.component import (
|
|
49
|
+
Component,
|
|
50
|
+
ComponentCategory,
|
|
51
|
+
ComponentConnection,
|
|
52
|
+
ComponentDataSamples,
|
|
53
|
+
ComponentStateSample,
|
|
54
|
+
GridConnectionPoint,
|
|
55
|
+
Inverter,
|
|
56
|
+
Battery,
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
# Metrics and bounds
|
|
60
|
+
from frequenz.client.microgrid.metrics import Metric, Bounds, MetricSample
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Update your imports to use these new modules instead of the removed legacy types.
|
|
64
|
+
|
|
65
|
+
### Metadata: `metadata()` → `get_microgrid_info()`
|
|
66
|
+
|
|
67
|
+
The old `metadata()` method has been replaced by `get_microgrid_info()` which returns a richer `MicrogridInfo` object.
|
|
68
|
+
|
|
69
|
+
### Listing components and connections
|
|
70
|
+
|
|
71
|
+
In `v0.9.1` you would often use:
|
|
72
|
+
|
|
73
|
+
```python
|
|
74
|
+
components = await client.components()
|
|
75
|
+
connections = await client.connections(starts={component_id}, ends=set())
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Now:
|
|
79
|
+
|
|
80
|
+
- **List components**:
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
components = await client.list_components(
|
|
84
|
+
components=[ComponentId(1), ComponentId(2)],
|
|
85
|
+
categories=[ComponentCategory.INVERTER, ComponentCategory.BATTERY],
|
|
86
|
+
)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Notes:
|
|
90
|
+
|
|
91
|
+
- `components` may contain `ComponentId` instances or `Component` objects.
|
|
92
|
+
- `categories` may contain `ComponentCategory` enum values or raw integer category IDs.
|
|
93
|
+
- Filters across `components` and `categories` are combined with `AND`; values inside each list are combined with `OR`.
|
|
94
|
+
|
|
95
|
+
- **List connections**:
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
connections = await client.list_connections(
|
|
99
|
+
sources=[ComponentId(1)],
|
|
100
|
+
destinations=[ComponentId(2)],
|
|
101
|
+
)
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Notes:
|
|
105
|
+
|
|
106
|
+
- `sources` and `destinations` accept `ComponentId` or `Component` instances.
|
|
107
|
+
- Filters across `sources` and `destinations` are combined with `AND`; values inside each list are combined with `OR`.
|
|
108
|
+
- Connections now also use `.source` and `.destination` terminology instead of `.start` and `.end`.
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### Sensors: `list_sensors()`, `stream_sensor_data()` → *removed* (temporary)
|
|
112
|
+
|
|
113
|
+
The old `list_sensors()` and `stream_sensor_data()` method has no direct equivalent. It will be reintroduced in a future release once sensor abstractions are reworked to fit the new component and metrics model.
|
|
114
|
+
|
|
115
|
+
### Power control: `set_power()` / `set_reactive_power()` → `set_component_power_active()` / `set_component_power_reactive()`
|
|
116
|
+
|
|
117
|
+
In `v0.9.1` you would typically set power using methods like:
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
await client.set_power(component_id, power_w)
|
|
121
|
+
await client.set_reactive_power(component_id, reactive_power_var)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
These methods have been replaced with lifetime-aware, metric-aligned calls:
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
# Active power in watts
|
|
128
|
+
expiry = await client.set_component_power_active(
|
|
129
|
+
component=ComponentId(1),
|
|
130
|
+
power_w=1_000.0,
|
|
131
|
+
request_lifetime=timedelta(seconds=30),
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Reactive power in volt-ampere reactive (var)
|
|
135
|
+
expiry = await client.set_component_power_reactive(
|
|
136
|
+
component=ComponentId(1),
|
|
137
|
+
power_var=500.0,
|
|
138
|
+
request_lifetime=timedelta(seconds=30),
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
- Both methods accept either `ComponentId` or `Component` instances.
|
|
143
|
+
|
|
144
|
+
### Bounds: `set_bounds()` → `add_component_bounds()`
|
|
145
|
+
|
|
146
|
+
In `v0.9.1`, power bounds were earlier set using methods like `set_bounds(component_id, lower, upper)`.
|
|
147
|
+
|
|
148
|
+
Now the new API reflects the `v0.18` metrics semantics: bounds are attached to metrics and transported as part of telemetry samples. Use `add_component_bounds()` together with `Metric` and `Bounds`:
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
await client.add_component_bounds(
|
|
152
|
+
component=ComponentId(1),
|
|
153
|
+
target=Metric.ACTIVE_POWER,
|
|
154
|
+
bounds=[Bounds(lower=-1_000.0, upper=1_000.0)],
|
|
155
|
+
)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Notes:
|
|
159
|
+
|
|
160
|
+
- Bounds are now metric-specific: you must specify a `Metric` when adding bounds.
|
|
161
|
+
- Bounds are represented as at most two ranges, matching `frequenz-api-common` `v1` (`Bounds` may contain up to two inclusive ranges).
|
|
162
|
+
|
|
163
|
+
### Streaming telemetry: `*_data()` → `receive_component_data_samples_stream()`
|
|
164
|
+
|
|
165
|
+
The streaming model changed significantly.
|
|
166
|
+
|
|
167
|
+
In `v0.9.1`, you would use:
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
receiver = await client.meter_data(component_id)
|
|
171
|
+
async for sample in receiver:
|
|
172
|
+
# sample is a MeterData instance
|
|
173
|
+
...
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Now, telemetry is integrated around components and metrics using `receive_component_data_samples_stream()` and `ComponentDataSamples`:
|
|
177
|
+
|
|
178
|
+
```python
|
|
179
|
+
receiver: Receiver[ComponentDataSamples] = (
|
|
180
|
+
await client.receive_component_data_samples_stream(
|
|
181
|
+
component=ComponentId(1),
|
|
182
|
+
metrics=[Metric.ACTIVE_POWER, Metric.REACTIVE_POWER],
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
async for samples in receiver:
|
|
187
|
+
# Each `samples` corresponds to a single component at a single timestamp.
|
|
188
|
+
# Metric values and bounds are attached per metric.
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The upstream Microgrid API `v0.18` changes how samples are structured; important points from the upstream migration notes (see `frequenz-api-microgrid` discussion #278):
|
|
192
|
+
|
|
193
|
+
- Rated bounds moved into component metadata; telemetry samples now carry operational bounds per metric.
|
|
194
|
+
- Old `component_bounds` and `system_{inclusion,exclusion}_bounds` are unified under `samples.metric[x].bounds`.
|
|
195
|
+
- Older voltage metrics like `VOLTAGE_PHASE_A` map to `AC_VOLTAGE_PHASE_A_N` and similar; review metric names in `frequenz.client.microgrid.metrics.Metric` when porting code.
|
|
196
|
+
- All metrics for a given component at a given time share the same `sampled_at` timestamp.
|
|
197
|
+
- At most one `ComponentState` is included per `ComponentData`.
|
|
198
|
+
|
|
199
|
+
When migrating:
|
|
200
|
+
|
|
201
|
+
- Prefer requesting only the metrics you actually consume.
|
|
202
|
+
- Use the new bounds representation instead of any previously maintained client-side bounds fields.
|
|
203
|
+
- Replace sensor-centric streams with component-centric streams; each telemetry message now contains all requested metrics for a component.
|
|
204
|
+
|
|
205
|
+
## New Features
|
|
206
|
+
|
|
207
|
+
- Add `get_microgrid_info()` returning a rich `MicrogridInfo` dataclass with ID, enterprise, location, delivery area, status, and timestamps.
|
|
208
|
+
- Add a metrics model under `frequenz.client.microgrid.metrics` including the `Metric` enum, `Bounds`, and `MetricSample`/`AggregatedMetricValue`.
|
|
209
|
+
- Add high-level methods on `MicrogridApiClient` for listing components and connections, adding component bounds, receiving component data samples streams, and controlling active/reactive power with lifetimes.
|
|
210
|
+
|
|
211
|
+
## Bug Fixes
|
|
212
|
+
|
|
213
|
+
- Restore missing `Metric` enum members to match the upstream common API definitions.
|
|
214
|
+
- Remove an artificial timeout from the gRPC telemetry stream to avoid spurious cancellations under normal operation.
|
|
215
|
+
- Align error handling and validation with the updated API behavior (for example, validating lifetimes and power ranges before sending control requests).
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
[build-system]
|
|
5
5
|
requires = [
|
|
6
6
|
"setuptools == 80.9.0",
|
|
7
|
-
"setuptools_scm[toml] ==
|
|
8
|
-
"frequenz-repo-config[lib] == 0.13.
|
|
7
|
+
"setuptools_scm[toml] == 9.2.2",
|
|
8
|
+
"frequenz-repo-config[lib] == 0.13.6",
|
|
9
9
|
]
|
|
10
10
|
build-backend = "setuptools.build_meta"
|
|
11
11
|
|
|
@@ -36,13 +36,14 @@ classifiers = [
|
|
|
36
36
|
]
|
|
37
37
|
requires-python = ">= 3.11, < 4"
|
|
38
38
|
dependencies = [
|
|
39
|
-
"frequenz-api-
|
|
40
|
-
"frequenz-
|
|
41
|
-
"frequenz-
|
|
42
|
-
"frequenz-client-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
39
|
+
"frequenz-api-common >= 0.8.0, < 1.0.0",
|
|
40
|
+
"frequenz-api-microgrid >= 0.18.0, < 0.19.0",
|
|
41
|
+
"frequenz-channels >= 1.6.1, < 2.0.0",
|
|
42
|
+
"frequenz-client-base >= 0.10.0, < 0.12.0",
|
|
43
|
+
"frequenz-client-common >= 0.3.6, < 0.4.0",
|
|
44
|
+
"frequenz-core >= 1.3.0, < 2.0.0",
|
|
45
|
+
"grpcio >= 1.72.1, < 2",
|
|
46
|
+
"protobuf >= 6.31.1, < 7",
|
|
46
47
|
"typing-extensions >= 4.13.0, < 5",
|
|
47
48
|
]
|
|
48
49
|
dynamic = ["version"]
|
|
@@ -53,45 +54,45 @@ email = "floss@frequenz.com"
|
|
|
53
54
|
|
|
54
55
|
[project.optional-dependencies]
|
|
55
56
|
dev-flake8 = [
|
|
56
|
-
"flake8 == 7.
|
|
57
|
+
"flake8 == 7.3.0",
|
|
57
58
|
"flake8-docstrings == 1.7.0",
|
|
58
59
|
"flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
|
|
59
|
-
"pydoclint == 0.
|
|
60
|
+
"pydoclint == 0.7.6",
|
|
60
61
|
"pydocstyle == 6.3.0",
|
|
61
62
|
]
|
|
62
|
-
dev-formatting = ["black == 25.
|
|
63
|
+
dev-formatting = ["black == 25.9.0", "isort == 6.1.0"]
|
|
63
64
|
dev-mkdocs = [
|
|
64
|
-
"black == 25.
|
|
65
|
-
"Markdown==3.
|
|
65
|
+
"black == 25.9.0",
|
|
66
|
+
"Markdown==3.9",
|
|
66
67
|
"mike == 2.1.3",
|
|
67
68
|
"mkdocs-gen-files == 0.5.0",
|
|
68
69
|
"mkdocs-literate-nav == 0.6.2",
|
|
69
|
-
"mkdocs-macros-plugin == 1.
|
|
70
|
-
"mkdocs-material == 9.6.
|
|
71
|
-
"mkdocstrings[python] == 0.
|
|
72
|
-
"mkdocstrings-python == 1.
|
|
73
|
-
"frequenz-repo-config[lib] == 0.13.
|
|
70
|
+
"mkdocs-macros-plugin == 1.4.1",
|
|
71
|
+
"mkdocs-material == 9.6.22",
|
|
72
|
+
"mkdocstrings[python] == 0.30.1",
|
|
73
|
+
"mkdocstrings-python == 1.18.2",
|
|
74
|
+
"frequenz-repo-config[lib] == 0.13.6",
|
|
74
75
|
]
|
|
75
76
|
dev-mypy = [
|
|
76
|
-
"mypy == 1.
|
|
77
|
+
"mypy == 1.18.2",
|
|
77
78
|
"grpc-stubs == 1.53.0.6",
|
|
78
|
-
"types-Markdown == 3.
|
|
79
|
-
"types-protobuf == 6.
|
|
79
|
+
"types-Markdown == 3.9.0.20250906",
|
|
80
|
+
"types-protobuf == 6.32.1.20250918",
|
|
80
81
|
# For checking the noxfile, docs/ script, and tests
|
|
81
82
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
82
83
|
]
|
|
83
|
-
dev-noxfile = ["nox == 2025.
|
|
84
|
+
dev-noxfile = ["nox == 2025.10.16", "frequenz-repo-config[lib] == 0.13.6"]
|
|
84
85
|
dev-pylint = [
|
|
85
|
-
"pylint ==
|
|
86
|
+
"pylint == 4.0.2",
|
|
86
87
|
# For checking the noxfile, docs/ script, and tests
|
|
87
88
|
"frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
|
|
88
89
|
]
|
|
89
90
|
dev-pytest = [
|
|
90
|
-
"pytest == 8.
|
|
91
|
-
"frequenz-repo-config[extra-lint-examples] == 0.13.
|
|
92
|
-
"pytest-mock == 3.
|
|
93
|
-
"pytest-asyncio ==
|
|
94
|
-
"async-solipsism == 0.
|
|
91
|
+
"pytest == 8.4.2",
|
|
92
|
+
"frequenz-repo-config[extra-lint-examples] == 0.13.6",
|
|
93
|
+
"pytest-mock == 3.15.1",
|
|
94
|
+
"pytest-asyncio == 1.2.0",
|
|
95
|
+
"async-solipsism == 0.8",
|
|
95
96
|
]
|
|
96
97
|
dev = [
|
|
97
98
|
"frequenz-client-microgrid[dev-mkdocs,dev-flake8,dev-formatting,dev-mkdocs,dev-mypy,dev-noxfile,dev-pylint,dev-pytest]",
|
|
@@ -130,6 +131,10 @@ check-yield-types = false
|
|
|
130
131
|
arg-type-hints-in-docstring = false
|
|
131
132
|
arg-type-hints-in-signature = true
|
|
132
133
|
allow-init-docstring = true
|
|
134
|
+
per-file-ignores = [
|
|
135
|
+
# Ignore the max-line-length (E501) because enum values are just too long
|
|
136
|
+
"src/frequenz/client/microgrid/metrics/_metric.py:E501",
|
|
137
|
+
]
|
|
133
138
|
|
|
134
139
|
[tool.pylint.similarities]
|
|
135
140
|
ignore-comments = ['yes']
|
|
@@ -7,39 +7,13 @@ This package provides a low-level interface for interacting with the microgrid A
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
from ._client import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ComponentMetricId,
|
|
16
|
-
ComponentType,
|
|
17
|
-
Fuse,
|
|
18
|
-
GridMetadata,
|
|
19
|
-
InverterType,
|
|
10
|
+
from ._client import (
|
|
11
|
+
DEFAULT_CHANNEL_OPTIONS,
|
|
12
|
+
DEFAULT_GRPC_CALL_TIMEOUT,
|
|
13
|
+
MicrogridApiClient,
|
|
14
|
+
Validity,
|
|
20
15
|
)
|
|
21
|
-
from .
|
|
22
|
-
BatteryData,
|
|
23
|
-
ComponentData,
|
|
24
|
-
EVChargerData,
|
|
25
|
-
InverterData,
|
|
26
|
-
MeterData,
|
|
27
|
-
)
|
|
28
|
-
from ._component_error import (
|
|
29
|
-
BatteryError,
|
|
30
|
-
BatteryErrorCode,
|
|
31
|
-
ErrorLevel,
|
|
32
|
-
InverterError,
|
|
33
|
-
InverterErrorCode,
|
|
34
|
-
)
|
|
35
|
-
from ._component_states import (
|
|
36
|
-
BatteryComponentState,
|
|
37
|
-
BatteryRelayState,
|
|
38
|
-
EVChargerCableState,
|
|
39
|
-
EVChargerComponentState,
|
|
40
|
-
InverterComponentState,
|
|
41
|
-
)
|
|
42
|
-
from ._connection import Connection
|
|
16
|
+
from ._delivery_area import DeliveryArea, EnergyMarketCodeType
|
|
43
17
|
from ._exception import (
|
|
44
18
|
ApiClientError,
|
|
45
19
|
ClientNotConnected,
|
|
@@ -63,45 +37,27 @@ from ._exception import (
|
|
|
63
37
|
UnrecognizedGrpcStatus,
|
|
64
38
|
)
|
|
65
39
|
from ._lifetime import Lifetime
|
|
66
|
-
from .
|
|
40
|
+
from ._location import Location
|
|
41
|
+
from ._microgrid_info import MicrogridInfo, MicrogridStatus
|
|
67
42
|
|
|
68
43
|
__all__ = [
|
|
69
44
|
"ApiClientError",
|
|
70
|
-
"BatteryComponentState",
|
|
71
|
-
"BatteryData",
|
|
72
|
-
"BatteryError",
|
|
73
|
-
"BatteryErrorCode",
|
|
74
|
-
"BatteryRelayState",
|
|
75
45
|
"ClientNotConnected",
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"ComponentData",
|
|
79
|
-
"ComponentMetadata",
|
|
80
|
-
"ComponentMetricId",
|
|
81
|
-
"ComponentType",
|
|
82
|
-
"Connection",
|
|
46
|
+
"DEFAULT_CHANNEL_OPTIONS",
|
|
47
|
+
"DEFAULT_GRPC_CALL_TIMEOUT",
|
|
83
48
|
"DataLoss",
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"EVChargerData",
|
|
49
|
+
"DeliveryArea",
|
|
50
|
+
"EnergyMarketCodeType",
|
|
87
51
|
"EntityAlreadyExists",
|
|
88
52
|
"EntityNotFound",
|
|
89
|
-
"ErrorLevel",
|
|
90
|
-
"Fuse",
|
|
91
|
-
"GridMetadata",
|
|
92
53
|
"GrpcError",
|
|
93
54
|
"InternalError",
|
|
94
55
|
"InvalidArgument",
|
|
95
|
-
"InverterComponentState",
|
|
96
|
-
"InverterData",
|
|
97
|
-
"InverterError",
|
|
98
|
-
"InverterErrorCode",
|
|
99
|
-
"InverterType",
|
|
100
56
|
"Lifetime",
|
|
101
57
|
"Location",
|
|
102
|
-
"Metadata",
|
|
103
|
-
"MeterData",
|
|
104
58
|
"MicrogridApiClient",
|
|
59
|
+
"MicrogridInfo",
|
|
60
|
+
"MicrogridStatus",
|
|
105
61
|
"OperationAborted",
|
|
106
62
|
"OperationCancelled",
|
|
107
63
|
"OperationNotImplemented",
|
|
@@ -114,4 +70,5 @@ __all__ = [
|
|
|
114
70
|
"ServiceUnavailable",
|
|
115
71
|
"UnknownError",
|
|
116
72
|
"UnrecognizedGrpcStatus",
|
|
73
|
+
"Validity",
|
|
117
74
|
]
|