frequenz-client-microgrid 0.18.2__tar.gz → 0.19.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.
Files changed (66) hide show
  1. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/PKG-INFO +20 -20
  2. frequenz_client_microgrid-0.19.0/RELEASE_NOTES.md +216 -0
  3. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/pyproject.toml +18 -18
  4. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/__init__.py +1 -0
  5. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_client.py +11 -130
  6. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz_client_microgrid.egg-info/PKG-INFO +20 -20
  7. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz_client_microgrid.egg-info/SOURCES.txt +0 -7
  8. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz_client_microgrid.egg-info/requires.txt +19 -19
  9. frequenz_client_microgrid-0.18.2/RELEASE_NOTES.md +0 -177
  10. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/__init__.py +0 -48
  11. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/_sensor.py +0 -57
  12. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/_sensor_proto.py +0 -93
  13. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/_state.py +0 -84
  14. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/_state_proto.py +0 -75
  15. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/_telemetry.py +0 -33
  16. frequenz_client_microgrid-0.18.2/src/frequenz/client/microgrid/sensor/_telemetry_proto.py +0 -49
  17. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/LICENSE +0 -0
  18. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/MANIFEST.in +0 -0
  19. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/README.md +0 -0
  20. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/setup.cfg +0 -0
  21. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_delivery_area.py +0 -0
  22. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_delivery_area_proto.py +0 -0
  23. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_exception.py +0 -0
  24. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_lifetime.py +0 -0
  25. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_lifetime_proto.py +0 -0
  26. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_location.py +0 -0
  27. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_location_proto.py +0 -0
  28. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_microgrid_info.py +0 -0
  29. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_microgrid_info_proto.py +0 -0
  30. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/_util.py +0 -0
  31. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/__init__.py +0 -0
  32. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_battery.py +0 -0
  33. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_category.py +0 -0
  34. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_chp.py +0 -0
  35. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_component.py +0 -0
  36. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_component_proto.py +0 -0
  37. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_connection.py +0 -0
  38. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_connection_proto.py +0 -0
  39. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_converter.py +0 -0
  40. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_crypto_miner.py +0 -0
  41. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_data_samples.py +0 -0
  42. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_data_samples_proto.py +0 -0
  43. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_electrolyzer.py +0 -0
  44. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_ev_charger.py +0 -0
  45. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_grid_connection_point.py +0 -0
  46. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_hvac.py +0 -0
  47. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_inverter.py +0 -0
  48. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_meter.py +0 -0
  49. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_precharger.py +0 -0
  50. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_problematic.py +0 -0
  51. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_relay.py +0 -0
  52. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_state_sample.py +0 -0
  53. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_state_sample_proto.py +0 -0
  54. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_types.py +0 -0
  55. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_voltage_transformer.py +0 -0
  56. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/component/_wind_turbine.py +0 -0
  57. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/conftest.py +0 -0
  58. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/metrics/__init__.py +0 -0
  59. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/metrics/_bounds.py +0 -0
  60. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/metrics/_bounds_proto.py +0 -0
  61. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/metrics/_metric.py +0 -0
  62. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/metrics/_sample.py +0 -0
  63. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/metrics/_sample_proto.py +0 -0
  64. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz/client/microgrid/py.typed +0 -0
  65. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.0}/src/frequenz_client_microgrid.egg-info/dependency_links.txt +0 -0
  66. {frequenz_client_microgrid-0.18.2 → frequenz_client_microgrid-0.19.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.18.2
3
+ Version: 0.19.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
@@ -33,38 +33,38 @@ Requires-Dist: typing-extensions<5,>=4.13.0
33
33
  Provides-Extra: dev-flake8
34
34
  Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
35
35
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
36
- Requires-Dist: flake8-pyproject==1.2.4; extra == "dev-flake8"
37
- Requires-Dist: pydoclint==0.8.3; extra == "dev-flake8"
36
+ Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
37
+ Requires-Dist: pydoclint==0.7.6; extra == "dev-flake8"
38
38
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
39
39
  Provides-Extra: dev-formatting
40
- Requires-Dist: black==25.12.0; extra == "dev-formatting"
41
- Requires-Dist: isort==7.0.0; extra == "dev-formatting"
40
+ Requires-Dist: black==25.9.0; extra == "dev-formatting"
41
+ Requires-Dist: isort==6.1.0; extra == "dev-formatting"
42
42
  Provides-Extra: dev-mkdocs
43
- Requires-Dist: black==25.12.0; extra == "dev-mkdocs"
44
- Requires-Dist: Markdown==3.10; extra == "dev-mkdocs"
43
+ Requires-Dist: black==25.9.0; extra == "dev-mkdocs"
44
+ Requires-Dist: Markdown==3.9; extra == "dev-mkdocs"
45
45
  Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
46
- Requires-Dist: mkdocs-gen-files==0.6.0; extra == "dev-mkdocs"
46
+ Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
47
47
  Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
48
- Requires-Dist: mkdocs-macros-plugin==1.5.0; extra == "dev-mkdocs"
49
- Requires-Dist: mkdocs-material==9.7.0; extra == "dev-mkdocs"
50
- Requires-Dist: mkdocstrings[python]==1.0.0; extra == "dev-mkdocs"
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
51
  Requires-Dist: mkdocstrings-python==1.18.2; extra == "dev-mkdocs"
52
- Requires-Dist: frequenz-repo-config[lib]==0.13.8; extra == "dev-mkdocs"
52
+ Requires-Dist: frequenz-repo-config[lib]==0.13.6; extra == "dev-mkdocs"
53
53
  Provides-Extra: dev-mypy
54
- Requires-Dist: mypy==1.19.0; extra == "dev-mypy"
54
+ Requires-Dist: mypy==1.18.2; extra == "dev-mypy"
55
55
  Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
56
- Requires-Dist: types-Markdown==3.10.0.20251106; extra == "dev-mypy"
57
- Requires-Dist: types-protobuf==6.32.1.20251105; extra == "dev-mypy"
56
+ Requires-Dist: types-Markdown==3.9.0.20250906; extra == "dev-mypy"
57
+ Requires-Dist: types-protobuf==6.32.1.20250918; extra == "dev-mypy"
58
58
  Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
59
59
  Provides-Extra: dev-noxfile
60
- Requires-Dist: nox==2025.11.12; extra == "dev-noxfile"
61
- Requires-Dist: frequenz-repo-config[lib]==0.13.8; extra == "dev-noxfile"
60
+ Requires-Dist: nox==2025.10.16; extra == "dev-noxfile"
61
+ Requires-Dist: frequenz-repo-config[lib]==0.13.6; extra == "dev-noxfile"
62
62
  Provides-Extra: dev-pylint
63
- Requires-Dist: pylint==4.0.4; extra == "dev-pylint"
63
+ Requires-Dist: pylint==4.0.2; extra == "dev-pylint"
64
64
  Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
65
65
  Provides-Extra: dev-pytest
66
- Requires-Dist: pytest==9.0.2; extra == "dev-pytest"
67
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.8; extra == "dev-pytest"
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
68
  Requires-Dist: pytest-mock==3.15.1; extra == "dev-pytest"
69
69
  Requires-Dist: pytest-asyncio==1.3.0; extra == "dev-pytest"
70
70
  Requires-Dist: async-solipsism==0.8; extra == "dev-pytest"
@@ -0,0 +1,216 @@
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
+ - Add `WindTurbine` component type.
211
+
212
+ ## Bug Fixes
213
+
214
+ - Restore missing `Metric` enum members to match the upstream common API definitions.
215
+ - Remove an artificial timeout from the gRPC telemetry stream to avoid spurious cancellations under normal operation.
216
+ - Align error handling and validation with the updated API behavior (for example, validating lifetimes and power ranges before sending control requests).
@@ -5,7 +5,7 @@
5
5
  requires = [
6
6
  "setuptools == 80.9.0",
7
7
  "setuptools_scm[toml] == 9.2.2",
8
- "frequenz-repo-config[lib] == 0.13.8",
8
+ "frequenz-repo-config[lib] == 0.13.6",
9
9
  ]
10
10
  build-backend = "setuptools.build_meta"
11
11
 
@@ -56,40 +56,40 @@ email = "floss@frequenz.com"
56
56
  dev-flake8 = [
57
57
  "flake8 == 7.3.0",
58
58
  "flake8-docstrings == 1.7.0",
59
- "flake8-pyproject == 1.2.4", # For reading the flake8 config from pyproject.toml
60
- "pydoclint == 0.8.3",
59
+ "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
60
+ "pydoclint == 0.7.6",
61
61
  "pydocstyle == 6.3.0",
62
62
  ]
63
- dev-formatting = ["black == 25.12.0", "isort == 7.0.0"]
63
+ dev-formatting = ["black == 25.9.0", "isort == 6.1.0"]
64
64
  dev-mkdocs = [
65
- "black == 25.12.0",
66
- "Markdown==3.10",
65
+ "black == 25.9.0",
66
+ "Markdown==3.9",
67
67
  "mike == 2.1.3",
68
- "mkdocs-gen-files == 0.6.0",
68
+ "mkdocs-gen-files == 0.5.0",
69
69
  "mkdocs-literate-nav == 0.6.2",
70
- "mkdocs-macros-plugin == 1.5.0",
71
- "mkdocs-material == 9.7.0",
72
- "mkdocstrings[python] == 1.0.0",
70
+ "mkdocs-macros-plugin == 1.4.1",
71
+ "mkdocs-material == 9.6.22",
72
+ "mkdocstrings[python] == 0.30.1",
73
73
  "mkdocstrings-python == 1.18.2",
74
- "frequenz-repo-config[lib] == 0.13.8",
74
+ "frequenz-repo-config[lib] == 0.13.6",
75
75
  ]
76
76
  dev-mypy = [
77
- "mypy == 1.19.0",
77
+ "mypy == 1.18.2",
78
78
  "grpc-stubs == 1.53.0.6",
79
- "types-Markdown == 3.10.0.20251106",
80
- "types-protobuf == 6.32.1.20251105",
79
+ "types-Markdown == 3.9.0.20250906",
80
+ "types-protobuf == 6.32.1.20250918",
81
81
  # For checking the noxfile, docs/ script, and tests
82
82
  "frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
83
83
  ]
84
- dev-noxfile = ["nox == 2025.11.12", "frequenz-repo-config[lib] == 0.13.8"]
84
+ dev-noxfile = ["nox == 2025.10.16", "frequenz-repo-config[lib] == 0.13.6"]
85
85
  dev-pylint = [
86
- "pylint == 4.0.4",
86
+ "pylint == 4.0.2",
87
87
  # For checking the noxfile, docs/ script, and tests
88
88
  "frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]",
89
89
  ]
90
90
  dev-pytest = [
91
- "pytest == 9.0.2",
92
- "frequenz-repo-config[extra-lint-examples] == 0.13.8",
91
+ "pytest == 8.4.2",
92
+ "frequenz-repo-config[extra-lint-examples] == 0.13.6",
93
93
  "pytest-mock == 3.15.1",
94
94
  "pytest-asyncio == 1.3.0",
95
95
  "async-solipsism == 0.8",
@@ -6,6 +6,7 @@
6
6
  This package provides a low-level interface for interacting with the microgrid API.
7
7
  """
8
8
 
9
+
9
10
  from ._client import (
10
11
  DEFAULT_CHANNEL_OPTIONS,
11
12
  DEFAULT_GRPC_CALL_TIMEOUT,
@@ -12,7 +12,7 @@ import math
12
12
  from collections.abc import Iterable
13
13
  from dataclasses import replace
14
14
  from datetime import datetime, timedelta
15
- from typing import Any, assert_never, cast
15
+ from typing import Any, assert_never
16
16
 
17
17
  from frequenz.api.common.v1alpha8.metrics import bounds_pb2, metrics_pb2
18
18
  from frequenz.api.common.v1alpha8.microgrid.electrical_components import (
@@ -23,7 +23,6 @@ from frequenz.channels import Receiver
23
23
  from frequenz.client.base import channel, client, conversion, retry, streaming
24
24
  from frequenz.client.base.exception import ApiClientError
25
25
  from frequenz.client.common.microgrid.components import ComponentId
26
- from frequenz.client.common.microgrid.sensors import SensorId
27
26
  from google.protobuf.empty_pb2 import Empty
28
27
  from grpc.aio import AioRpcError
29
28
  from typing_extensions import override
@@ -41,10 +40,6 @@ from .component._data_samples_proto import component_data_samples_from_proto
41
40
  from .component._types import ComponentTypes
42
41
  from .metrics._bounds import Bounds
43
42
  from .metrics._metric import Metric
44
- from .sensor._sensor import Sensor
45
- from .sensor._sensor_proto import sensor_from_proto
46
- from .sensor._telemetry import SensorTelemetry
47
- from .sensor._telemetry_proto import sensor_telemetry_from_proto
48
43
 
49
44
  DEFAULT_GRPC_CALL_TIMEOUT = 60.0
50
45
  """The default timeout for gRPC calls made by this client (in seconds)."""
@@ -105,10 +100,7 @@ class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub])
105
100
  ] = {}
106
101
  self._sensor_data_broadcasters: dict[
107
102
  str,
108
- streaming.GrpcStreamBroadcaster[
109
- microgrid_pb2.ReceiveSensorTelemetryStreamResponse,
110
- SensorTelemetry,
111
- ],
103
+ streaming.GrpcStreamBroadcaster[Any, Any],
112
104
  ] = {}
113
105
  self._retry_strategy = retry_strategy
114
106
 
@@ -131,19 +123,16 @@ class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub])
131
123
  exc_tb: Any | None,
132
124
  ) -> bool | None:
133
125
  """Close the gRPC channel and stop all broadcasters."""
134
- all_broadcasters = cast(
135
- list[streaming.GrpcStreamBroadcaster[Any, Any]],
136
- list(
137
- itertools.chain(
138
- self._component_data_broadcasters.values(),
139
- self._sensor_data_broadcasters.values(),
140
- )
141
- ),
142
- )
143
126
  exceptions = list(
144
127
  exc
145
128
  for exc in await asyncio.gather(
146
- *(broadcaster.stop() for broadcaster in all_broadcasters),
129
+ *(
130
+ broadcaster.stop()
131
+ for broadcaster in itertools.chain(
132
+ self._component_data_broadcasters.values(),
133
+ self._sensor_data_broadcasters.values(),
134
+ )
135
+ ),
147
136
  return_exceptions=True,
148
137
  )
149
138
  if isinstance(exc, BaseException)
@@ -224,7 +213,7 @@ class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub])
224
213
  Iterator whose elements are all the components in the local microgrid.
225
214
 
226
215
  Raises:
227
- ApiClientError: If there are any errors communicating with the Microgrid API,
216
+ ApiClientError: If the are any errors communicating with the Microgrid API,
228
217
  most likely a subclass of
229
218
  [GrpcError][frequenz.client.microgrid.GrpcError].
230
219
  """
@@ -280,7 +269,7 @@ class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub])
280
269
  Iterator whose elements are all the connections in the local microgrid.
281
270
 
282
271
  Raises:
283
- ApiClientError: If there are any errors communicating with the Microgrid API,
272
+ ApiClientError: If the are any errors communicating with the Microgrid API,
284
273
  most likely a subclass of
285
274
  [GrpcError][frequenz.client.microgrid.GrpcError].
286
275
  """
@@ -307,41 +296,6 @@ class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub])
307
296
  if conn is not None
308
297
  )
309
298
 
310
- async def list_sensors( # noqa: DOC502 (raises ApiClientError indirectly)
311
- self,
312
- *,
313
- sensors: Iterable[SensorId | Sensor] = (),
314
- ) -> Iterable[Sensor]:
315
- """Fetch all the sensors present in the local microgrid.
316
-
317
- Sensors are devices that measure physical properties in the microgrid's
318
- surroundings, such as temperature, humidity, and solar irradiance. Unlike
319
- electrical components, sensors are not part of the electrical infrastructure.
320
-
321
- Args:
322
- sensors: The sensors to fetch. If empty, all sensors are fetched.
323
-
324
- Returns:
325
- Iterator whose elements are all the sensors in the local microgrid.
326
-
327
- Raises:
328
- ApiClientError: If there are any errors communicating with the Microgrid API,
329
- most likely a subclass of
330
- [GrpcError][frequenz.client.microgrid.GrpcError].
331
- """
332
- response = await client.call_stub_method(
333
- self,
334
- lambda: self.stub.ListSensors(
335
- microgrid_pb2.ListSensorRequest(
336
- sensor_ids=map(_get_sensor_id, sensors),
337
- ),
338
- timeout=DEFAULT_GRPC_CALL_TIMEOUT,
339
- ),
340
- method_name="ListSensors",
341
- )
342
-
343
- return map(sensor_from_proto, response.sensors)
344
-
345
299
  # pylint: disable-next=fixme
346
300
  # TODO: Unifi set_component_power_active and set_component_power_reactive, or at
347
301
  # least use a common implementation.
@@ -678,68 +632,6 @@ class MicrogridApiClient(client.BaseApiClient[microgrid_pb2_grpc.MicrogridStub])
678
632
  self._component_data_broadcasters[key] = broadcaster
679
633
  return broadcaster.new_receiver(maxsize=buffer_size)
680
634
 
681
- def receive_sensor_telemetry_stream(
682
- self,
683
- sensor: SensorId | Sensor,
684
- metrics: Iterable[Metric | int],
685
- *,
686
- buffer_size: int = 50,
687
- ) -> Receiver[SensorTelemetry]:
688
- """Stream telemetry data from a sensor.
689
-
690
- At least one metric must be specified. If no metric is specified, then the
691
- stream will raise an error.
692
-
693
- Warning:
694
- Sensors may not support all metrics. If a sensor does not support
695
- a given metric, then the returned data stream will not contain that metric.
696
-
697
- There is no way to tell if a metric is not being received because the
698
- sensor does not support it or because there is a transient issue when
699
- retrieving the metric from the sensor.
700
-
701
- The supported metrics by a sensor can even change with time, for example,
702
- if a sensor is updated with new firmware.
703
-
704
- Args:
705
- sensor: The sensor to stream data from.
706
- metrics: List of metrics to return. Only the specified metrics will be
707
- returned.
708
- buffer_size: The maximum number of messages to buffer in the returned
709
- receiver. After this limit is reached, the oldest messages will be
710
- dropped.
711
-
712
- Returns:
713
- The telemetry stream from the sensor.
714
- """
715
- sensor_id = _get_sensor_id(sensor)
716
- metrics_set = frozenset([_get_metric_value(m) for m in metrics])
717
- key = f"{sensor_id}-{hash(metrics_set)}"
718
- broadcaster = self._sensor_data_broadcasters.get(key)
719
- if broadcaster is None:
720
- client_id = hex(id(self))[2:]
721
- stream_name = f"microgrid-client-{client_id}-sensor-data-{key}"
722
- # Alias to avoid too long lines linter errors
723
- # pylint: disable-next=invalid-name
724
- Request = microgrid_pb2.ReceiveSensorTelemetryStreamRequest
725
- broadcaster = streaming.GrpcStreamBroadcaster(
726
- stream_name,
727
- lambda: aiter(
728
- self.stub.ReceiveSensorTelemetryStream(
729
- Request(
730
- sensor_id=sensor_id,
731
- filter=Request.SensorTelemetryStreamFilter(
732
- metrics=metrics_set
733
- ),
734
- ),
735
- )
736
- ),
737
- lambda msg: sensor_telemetry_from_proto(msg.telemetry),
738
- retry_strategy=self._retry_strategy,
739
- )
740
- self._sensor_data_broadcasters[key] = broadcaster
741
- return broadcaster.new_receiver(maxsize=buffer_size)
742
-
743
635
 
744
636
  # pylint: disable-next=fixme
745
637
  # TODO: Remove this enum, now AugmentElectricalComponentBounds takes a simple timeout as
@@ -771,17 +663,6 @@ def _get_component_id(component: ComponentId | Component) -> int:
771
663
  assert_never(unexpected)
772
664
 
773
665
 
774
- def _get_sensor_id(sensor: SensorId | Sensor) -> int:
775
- """Get the sensor ID from a sensor or sensor ID."""
776
- match sensor:
777
- case SensorId():
778
- return int(sensor)
779
- case Sensor():
780
- return int(sensor.id)
781
- case unexpected:
782
- assert_never(unexpected)
783
-
784
-
785
666
  def _get_metric_value(metric: Metric | int) -> metrics_pb2.Metric.ValueType:
786
667
  """Get the metric ID from a metric or metric ID."""
787
668
  match metric:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-client-microgrid
3
- Version: 0.18.2
3
+ Version: 0.19.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
@@ -33,38 +33,38 @@ Requires-Dist: typing-extensions<5,>=4.13.0
33
33
  Provides-Extra: dev-flake8
34
34
  Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
35
35
  Requires-Dist: flake8-docstrings==1.7.0; extra == "dev-flake8"
36
- Requires-Dist: flake8-pyproject==1.2.4; extra == "dev-flake8"
37
- Requires-Dist: pydoclint==0.8.3; extra == "dev-flake8"
36
+ Requires-Dist: flake8-pyproject==1.2.3; extra == "dev-flake8"
37
+ Requires-Dist: pydoclint==0.7.6; extra == "dev-flake8"
38
38
  Requires-Dist: pydocstyle==6.3.0; extra == "dev-flake8"
39
39
  Provides-Extra: dev-formatting
40
- Requires-Dist: black==25.12.0; extra == "dev-formatting"
41
- Requires-Dist: isort==7.0.0; extra == "dev-formatting"
40
+ Requires-Dist: black==25.9.0; extra == "dev-formatting"
41
+ Requires-Dist: isort==6.1.0; extra == "dev-formatting"
42
42
  Provides-Extra: dev-mkdocs
43
- Requires-Dist: black==25.12.0; extra == "dev-mkdocs"
44
- Requires-Dist: Markdown==3.10; extra == "dev-mkdocs"
43
+ Requires-Dist: black==25.9.0; extra == "dev-mkdocs"
44
+ Requires-Dist: Markdown==3.9; extra == "dev-mkdocs"
45
45
  Requires-Dist: mike==2.1.3; extra == "dev-mkdocs"
46
- Requires-Dist: mkdocs-gen-files==0.6.0; extra == "dev-mkdocs"
46
+ Requires-Dist: mkdocs-gen-files==0.5.0; extra == "dev-mkdocs"
47
47
  Requires-Dist: mkdocs-literate-nav==0.6.2; extra == "dev-mkdocs"
48
- Requires-Dist: mkdocs-macros-plugin==1.5.0; extra == "dev-mkdocs"
49
- Requires-Dist: mkdocs-material==9.7.0; extra == "dev-mkdocs"
50
- Requires-Dist: mkdocstrings[python]==1.0.0; extra == "dev-mkdocs"
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
51
  Requires-Dist: mkdocstrings-python==1.18.2; extra == "dev-mkdocs"
52
- Requires-Dist: frequenz-repo-config[lib]==0.13.8; extra == "dev-mkdocs"
52
+ Requires-Dist: frequenz-repo-config[lib]==0.13.6; extra == "dev-mkdocs"
53
53
  Provides-Extra: dev-mypy
54
- Requires-Dist: mypy==1.19.0; extra == "dev-mypy"
54
+ Requires-Dist: mypy==1.18.2; extra == "dev-mypy"
55
55
  Requires-Dist: grpc-stubs==1.53.0.6; extra == "dev-mypy"
56
- Requires-Dist: types-Markdown==3.10.0.20251106; extra == "dev-mypy"
57
- Requires-Dist: types-protobuf==6.32.1.20251105; extra == "dev-mypy"
56
+ Requires-Dist: types-Markdown==3.9.0.20250906; extra == "dev-mypy"
57
+ Requires-Dist: types-protobuf==6.32.1.20250918; extra == "dev-mypy"
58
58
  Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-mypy"
59
59
  Provides-Extra: dev-noxfile
60
- Requires-Dist: nox==2025.11.12; extra == "dev-noxfile"
61
- Requires-Dist: frequenz-repo-config[lib]==0.13.8; extra == "dev-noxfile"
60
+ Requires-Dist: nox==2025.10.16; extra == "dev-noxfile"
61
+ Requires-Dist: frequenz-repo-config[lib]==0.13.6; extra == "dev-noxfile"
62
62
  Provides-Extra: dev-pylint
63
- Requires-Dist: pylint==4.0.4; extra == "dev-pylint"
63
+ Requires-Dist: pylint==4.0.2; extra == "dev-pylint"
64
64
  Requires-Dist: frequenz-client-microgrid[dev-mkdocs,dev-noxfile,dev-pytest]; extra == "dev-pylint"
65
65
  Provides-Extra: dev-pytest
66
- Requires-Dist: pytest==9.0.2; extra == "dev-pytest"
67
- Requires-Dist: frequenz-repo-config[extra-lint-examples]==0.13.8; extra == "dev-pytest"
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
68
  Requires-Dist: pytest-mock==3.15.1; extra == "dev-pytest"
69
69
  Requires-Dist: pytest-asyncio==1.3.0; extra == "dev-pytest"
70
70
  Requires-Dist: async-solipsism==0.8; extra == "dev-pytest"
@@ -49,13 +49,6 @@ src/frequenz/client/microgrid/metrics/_bounds_proto.py
49
49
  src/frequenz/client/microgrid/metrics/_metric.py
50
50
  src/frequenz/client/microgrid/metrics/_sample.py
51
51
  src/frequenz/client/microgrid/metrics/_sample_proto.py
52
- src/frequenz/client/microgrid/sensor/__init__.py
53
- src/frequenz/client/microgrid/sensor/_sensor.py
54
- src/frequenz/client/microgrid/sensor/_sensor_proto.py
55
- src/frequenz/client/microgrid/sensor/_state.py
56
- src/frequenz/client/microgrid/sensor/_state_proto.py
57
- src/frequenz/client/microgrid/sensor/_telemetry.py
58
- src/frequenz/client/microgrid/sensor/_telemetry_proto.py
59
52
  src/frequenz_client_microgrid.egg-info/PKG-INFO
60
53
  src/frequenz_client_microgrid.egg-info/SOURCES.txt
61
54
  src/frequenz_client_microgrid.egg-info/dependency_links.txt