|
6 | 6 |
|
7 | 7 | ## Upgrading |
8 | 8 |
|
9 | | -<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with --> |
| 9 | +* The `UNSPECIFIED` members in the following enums are now deprecated: |
| 10 | + |
| 11 | + * `frequenz.client.common.grid.EnergyMarketCodeType` |
| 12 | + * `frequenz.client.common.metrics.Metric` |
| 13 | + * `frequenz.client.common.metrics.MetricConnectionCategory` |
| 14 | + |
| 15 | + When loading these types from protobuf using dataclass-level converters (e.g., `delivery_area_from_proto`, `metric_sample_from_proto`), the low-level fields (`code_type`, `category`, `metric`) now store the raw integer `0` for unspecified values instead of the deprecated member. Unspecified values should be rare errors, so it is better to expose them only via the low-level interface. |
| 16 | + |
| 17 | + Lower-level enum-level converters still return the deprecated member. |
| 18 | + |
| 19 | + Users are encouraged to switch from direct field access to the new `get_*()` methods (see New Features), which provide a safer way to handle unspecified or unrecognized values. |
10 | 20 |
|
11 | 21 | ## New Features |
12 | 22 |
|
| 23 | +* Added new exceptions: |
| 24 | + |
| 25 | + * `frequenz.client.common.ClientCommonError` as a base exception for the package. |
| 26 | + * `frequenz.client.common.UnspecifiedValueError` for unspecified values (raw `0` or the deprecated member). |
| 27 | + * `frequenz.client.common.UnrecognizedValueError` for enum members not yet recognized by the library. Carries the raw integer value in its `value` attribute. |
| 28 | + |
| 29 | +* Added safe convenience getters that raise the new exceptions for unspecified or unrecognized values: |
| 30 | + |
| 31 | + * `frequenz.client.common.grid.DeliveryArea.get_code_type()` |
| 32 | + * `frequenz.client.common.metrics.MetricConnection.get_category()` |
| 33 | + * `frequenz.client.common.metrics.MetricSample.get_metric()` |
| 34 | + |
13 | 35 | * Added a new `frequenz.client.common.types.Lifetime` type together with the `frequenz.client.common.types.proto.v1alpha8.lifetime_from_proto` conversion function. |
| 36 | + |
14 | 37 | * Added a new `frequenz.client.common.types.Location` type together with the `frequenz.client.common.types.proto.v1alpha8.location_from_proto` conversion function. |
| 38 | + |
15 | 39 | * Added a new `frequenz.client.common.microgrid.Microgrid` type, together with the `frequenz.client.common.microgrid.proto.v1alpha8.microgrid_from_proto` conversion function. |
16 | | -* Added a new `frequenz.client.common.ClientCommonError` base exception and `UnspecifiedValueError` at the package root. |
| 40 | + |
17 | 41 | * Added a new `frequenz.client.common.microgrid.electrical_components` package, featuring a `ElectricalComponent` class hierarchy and its families (battery, inverter, EV charger, etc.), and `ElectricalComponentConnection`, including `v1alpha8` proto conversion functions. |
18 | 42 | * Added a new `frequenz.client.common.microgrid.Microgrid` type with a raising `is_active()` method, together with the `frequenz.client.common.microgrid.proto.v1alpha8.microgrid_from_proto` conversion function. |
19 | 43 |
|
|
0 commit comments