frequenz-client-common 0.3.4__tar.gz → 0.3.5__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 (29) hide show
  1. {frequenz_client_common-0.3.4/src/frequenz_client_common.egg-info → frequenz_client_common-0.3.5}/PKG-INFO +2 -2
  2. frequenz_client_common-0.3.5/RELEASE_NOTES.md +20 -0
  3. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/pyproject.toml +2 -2
  4. {frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8 → frequenz_client_common-0.3.5/src/frequenz/client/common}/pagination/__init__.py +74 -5
  5. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5/src/frequenz_client_common.egg-info}/PKG-INFO +2 -2
  6. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz_client_common.egg-info/SOURCES.txt +2 -7
  7. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz_client_common.egg-info/requires.txt +1 -1
  8. frequenz_client_common-0.3.4/RELEASE_NOTES.md +0 -18
  9. frequenz_client_common-0.3.4/src/frequenz/client/common/pagination/__init__.py +0 -87
  10. frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8/__init__.py +0 -4
  11. frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8/metric/__init__.py +0 -162
  12. frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8/microgrid/__init__.py +0 -18
  13. frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8/microgrid/sensors.py +0 -13
  14. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/LICENSE +0 -0
  15. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/MANIFEST.in +0 -0
  16. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/README.md +0 -0
  17. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/setup.cfg +0 -0
  18. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/__init__.py +0 -0
  19. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/conftest.py +0 -0
  20. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/enum_proto.py +0 -0
  21. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/metric/__init__.py +0 -0
  22. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/microgrid/__init__.py +0 -0
  23. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/microgrid/components/__init__.py +0 -0
  24. {frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8 → frequenz_client_common-0.3.5/src/frequenz/client/common}/microgrid/electrical_components/__init__.py +0 -0
  25. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/microgrid/sensors.py +0 -0
  26. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz/client/common/py.typed +0 -0
  27. {frequenz_client_common-0.3.4/src/frequenz/client/common/v1alpha8 → frequenz_client_common-0.3.5/src/frequenz/client/common}/streaming/__init__.py +0 -0
  28. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz_client_common.egg-info/dependency_links.txt +0 -0
  29. {frequenz_client_common-0.3.4 → frequenz_client_common-0.3.5}/src/frequenz_client_common.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-client-common
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Common code and utilities for Frequenz API clients
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
6
  License: MIT
@@ -21,7 +21,7 @@ Requires-Python: <4,>=3.11
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: typing-extensions<5,>=4.13.0
24
- Requires-Dist: frequenz-api-common<9,>=0.8.0
24
+ Requires-Dist: frequenz-api-common<1,>=0.8.0
25
25
  Requires-Dist: frequenz-core<2,>=1.0.2
26
26
  Provides-Extra: dev-flake8
27
27
  Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
@@ -0,0 +1,20 @@
1
+ # Frequenz Client Common Library Release Notes
2
+
3
+ ## Summary
4
+
5
+
6
+ ## Upgrading
7
+
8
+ - The `pagination.Params` class is deprecated; use the protobuf message directly.
9
+ - The `pagination.Info` class is deprecated in favor of the new `pagination.PaginationInfo` class.
10
+
11
+ ## New Features
12
+
13
+ - Mapping for the new `Event` message has been added.
14
+ - Add new common API enums for `ElectricalComponent` (previously `Components`).
15
+
16
+ - Added `v1alpha8` variants of the pagination data structures.
17
+
18
+ ## Bug Fixes
19
+
20
+ - Updated display of protobuf version warnings
@@ -27,7 +27,7 @@ classifiers = [
27
27
  requires-python = ">= 3.11, < 4"
28
28
  dependencies = [
29
29
  "typing-extensions >= 4.13.0, < 5",
30
- "frequenz-api-common >= 0.8.0, < 9",
30
+ "frequenz-api-common >= 0.8.0, < 1",
31
31
  "frequenz-core >= 1.0.2, < 2",
32
32
  ]
33
33
  dynamic = ["version"]
@@ -40,7 +40,7 @@ email = "floss@frequenz.com"
40
40
  dev-flake8 = [
41
41
  "flake8 == 7.3.0",
42
42
  "flake8-docstrings == 1.7.0",
43
- "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
43
+ "flake8-pyproject == 1.2.3", # For reading the flake8 config from pyproject.toml
44
44
  "pydoclint == 0.6.6",
45
45
  "pydocstyle == 6.3.0",
46
46
  ]
@@ -9,18 +9,27 @@ from dataclasses import dataclass
9
9
  from typing import Self
10
10
 
11
11
  # pylint: disable=no-name-in-module
12
- from frequenz.api.common.v1alpha8.pagination.pagination_info_pb2 import (
12
+ from frequenz.api.common.v1.pagination.pagination_info_pb2 import (
13
13
  PaginationInfo as PBPaginationInfo,
14
14
  )
15
- from frequenz.api.common.v1alpha8.pagination.pagination_params_pb2 import (
15
+ from frequenz.api.common.v1.pagination.pagination_params_pb2 import (
16
16
  PaginationParams as PBPaginationParams,
17
17
  )
18
+ from frequenz.api.common.v1alpha8.pagination.pagination_info_pb2 import (
19
+ PaginationInfo as PBPaginationInfoAlpha8,
20
+ )
21
+ from typing_extensions import deprecated
18
22
 
19
23
  # pylint: enable=no-name-in-module
20
24
 
21
25
 
26
+ @deprecated(
27
+ "Params is deprecated, use "
28
+ "frequenz.api.common.v1.pagination.pagination_params_pb2.PaginationParams"
29
+ " from the API directly instead.",
30
+ )
22
31
  @dataclass(frozen=True, kw_only=True)
23
- class PaginationParams:
32
+ class Params:
24
33
  """Parameters for paginating list requests."""
25
34
 
26
35
  page_size: int
@@ -31,7 +40,7 @@ class PaginationParams:
31
40
 
32
41
  @classmethod
33
42
  def from_proto(cls, pagination_params: PBPaginationParams) -> Self:
34
- """Convert a protobuf PaginationParams to python PaginationParams object.
43
+ """Convert a protobuf Params to PaginationParams object.
35
44
 
36
45
  Args:
37
46
  pagination_params: Params to convert.
@@ -55,8 +64,11 @@ class PaginationParams:
55
64
  )
56
65
 
57
66
 
67
+ @deprecated(
68
+ "Info is deprecated, use PaginationInfo instead.",
69
+ )
58
70
  @dataclass(frozen=True, kw_only=True)
59
- class PaginationInfo:
71
+ class Info:
60
72
  """Information about the pagination of a list request."""
61
73
 
62
74
  total_items: int
@@ -89,3 +101,60 @@ class PaginationInfo:
89
101
  total_items=self.total_items,
90
102
  next_page_token=self.next_page_token,
91
103
  )
104
+
105
+
106
+ @dataclass(frozen=True, kw_only=True)
107
+ class PaginationInfo:
108
+ """Information about the pagination of a list request."""
109
+
110
+ total_items: int
111
+ """The total number of items that match the request."""
112
+
113
+ next_page_token: str | None = None
114
+ """The token identifying the next page of results."""
115
+
116
+ @classmethod
117
+ def from_proto(
118
+ cls, pagination_info: PBPaginationInfoAlpha8 | PBPaginationInfo
119
+ ) -> Self:
120
+ """Convert a protobuf PBPaginationInfo to Info object.
121
+
122
+ Args:
123
+ pagination_info: Info to convert.
124
+ Returns:
125
+ Info object corresponding to the protobuf message.
126
+ """
127
+ # We check for truthiness here to handle both cases where the token is
128
+ # not set (defaults to "") or is explicitly set to "". In both
129
+ # situations, we want to return `None`. Using `HasField("next_page_token")`
130
+ # would not handle the case where the token is explicitly set to "".
131
+ return cls(
132
+ total_items=pagination_info.total_items,
133
+ next_page_token=(
134
+ pagination_info.next_page_token
135
+ if pagination_info.next_page_token
136
+ else None
137
+ ),
138
+ )
139
+
140
+ def to_proto_v1alpha8(self) -> PBPaginationInfoAlpha8:
141
+ """Convert a Info object to protobuf PBPaginationInfo.
142
+
143
+ Returns:
144
+ Protobuf message corresponding to the Info object.
145
+ """
146
+ return PBPaginationInfoAlpha8(
147
+ total_items=self.total_items,
148
+ next_page_token=self.next_page_token,
149
+ )
150
+
151
+ def to_proto(self) -> PBPaginationInfo:
152
+ """Convert a Info object to protobuf PBPaginationInfo.
153
+
154
+ Returns:
155
+ Protobuf message corresponding to the Info object.
156
+ """
157
+ return PBPaginationInfo(
158
+ total_items=self.total_items,
159
+ next_page_token=self.next_page_token,
160
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: frequenz-client-common
3
- Version: 0.3.4
3
+ Version: 0.3.5
4
4
  Summary: Common code and utilities for Frequenz API clients
5
5
  Author-email: Frequenz Energy-as-a-Service GmbH <floss@frequenz.com>
6
6
  License: MIT
@@ -21,7 +21,7 @@ Requires-Python: <4,>=3.11
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
23
  Requires-Dist: typing-extensions<5,>=4.13.0
24
- Requires-Dist: frequenz-api-common<9,>=0.8.0
24
+ Requires-Dist: frequenz-api-common<1,>=0.8.0
25
25
  Requires-Dist: frequenz-core<2,>=1.0.2
26
26
  Provides-Extra: dev-flake8
27
27
  Requires-Dist: flake8==7.3.0; extra == "dev-flake8"
@@ -11,14 +11,9 @@ src/frequenz/client/common/metric/__init__.py
11
11
  src/frequenz/client/common/microgrid/__init__.py
12
12
  src/frequenz/client/common/microgrid/sensors.py
13
13
  src/frequenz/client/common/microgrid/components/__init__.py
14
+ src/frequenz/client/common/microgrid/electrical_components/__init__.py
14
15
  src/frequenz/client/common/pagination/__init__.py
15
- src/frequenz/client/common/v1alpha8/__init__.py
16
- src/frequenz/client/common/v1alpha8/metric/__init__.py
17
- src/frequenz/client/common/v1alpha8/microgrid/__init__.py
18
- src/frequenz/client/common/v1alpha8/microgrid/sensors.py
19
- src/frequenz/client/common/v1alpha8/microgrid/electrical_components/__init__.py
20
- src/frequenz/client/common/v1alpha8/pagination/__init__.py
21
- src/frequenz/client/common/v1alpha8/streaming/__init__.py
16
+ src/frequenz/client/common/streaming/__init__.py
22
17
  src/frequenz_client_common.egg-info/PKG-INFO
23
18
  src/frequenz_client_common.egg-info/SOURCES.txt
24
19
  src/frequenz_client_common.egg-info/dependency_links.txt
@@ -1,5 +1,5 @@
1
1
  typing-extensions<5,>=4.13.0
2
- frequenz-api-common<9,>=0.8.0
2
+ frequenz-api-common<1,>=0.8.0
3
3
  frequenz-core<2,>=1.0.2
4
4
 
5
5
  [dev]
@@ -1,18 +0,0 @@
1
- # Frequenz Client Common Library Release Notes
2
-
3
- ## Summary
4
-
5
- This release introduces the `v1alpha8` module to support a new API version.
6
-
7
- ## Upgrading
8
-
9
- <!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with -->
10
-
11
- ## New Features
12
-
13
- - Provide access to new API using new `v1alpha8` module.
14
- - Mapping for the new `Event` message has been added.
15
-
16
- ## Bug Fixes
17
-
18
- - Updated display of protobuf version warnings
@@ -1,87 +0,0 @@
1
- # License: MIT
2
- # Copyright © 2024 Frequenz Energy-as-a-Service GmbH
3
-
4
- """Module to define the pagination used with the common client."""
5
-
6
- from __future__ import annotations # required for constructor type hinting
7
-
8
- from dataclasses import dataclass
9
- from typing import Self
10
-
11
- # pylint: disable=no-name-in-module
12
- from frequenz.api.common.v1.pagination.pagination_info_pb2 import PaginationInfo
13
- from frequenz.api.common.v1.pagination.pagination_params_pb2 import PaginationParams
14
-
15
- # pylint: enable=no-name-in-module
16
-
17
-
18
- @dataclass(frozen=True, kw_only=True)
19
- class Params:
20
- """Parameters for paginating list requests."""
21
-
22
- page_size: int
23
- """The maximum number of results to be returned per request."""
24
-
25
- page_token: str
26
- """The token identifying a specific page of the list results."""
27
-
28
- @classmethod
29
- def from_proto(cls, pagination_params: PaginationParams) -> Self:
30
- """Convert a protobuf Params to PaginationParams object.
31
-
32
- Args:
33
- pagination_params: Params to convert.
34
- Returns:
35
- Params object corresponding to the protobuf message.
36
- """
37
- return cls(
38
- page_size=pagination_params.page_size,
39
- page_token=pagination_params.page_token,
40
- )
41
-
42
- def to_proto(self) -> PaginationParams:
43
- """Convert a Params object to protobuf PaginationParams.
44
-
45
- Returns:
46
- Protobuf message corresponding to the Params object.
47
- """
48
- return PaginationParams(
49
- page_size=self.page_size,
50
- page_token=self.page_token,
51
- )
52
-
53
-
54
- @dataclass(frozen=True, kw_only=True)
55
- class Info:
56
- """Information about the pagination of a list request."""
57
-
58
- total_items: int
59
- """The total number of items that match the request."""
60
-
61
- next_page_token: str | None = None
62
- """The token identifying the next page of results."""
63
-
64
- @classmethod
65
- def from_proto(cls, pagination_info: PaginationInfo) -> Self:
66
- """Convert a protobuf PBPaginationInfo to Info object.
67
-
68
- Args:
69
- pagination_info: Info to convert.
70
- Returns:
71
- Info object corresponding to the protobuf message.
72
- """
73
- return cls(
74
- total_items=pagination_info.total_items,
75
- next_page_token=pagination_info.next_page_token,
76
- )
77
-
78
- def to_proto(self) -> PaginationInfo:
79
- """Convert a Info object to protobuf PBPaginationInfo.
80
-
81
- Returns:
82
- Protobuf message corresponding to the Info object.
83
- """
84
- return PaginationInfo(
85
- total_items=self.total_items,
86
- next_page_token=self.next_page_token,
87
- )
@@ -1,4 +0,0 @@
1
- # License: MIT
2
- # Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3
-
4
- """Types introduced or modified in the v1alpha8 version of the common api."""
@@ -1,162 +0,0 @@
1
- # License: MIT
2
- # Copyright © 2024 Frequenz Energy-as-a-Service GmbH
3
-
4
- """Module to define the metrics used with the common client."""
5
-
6
- import enum
7
- from typing import Self
8
-
9
- from frequenz.api.common.v1alpha8.metrics.metrics_pb2 import Metric as PBMetric
10
- from typing_extensions import deprecated
11
-
12
-
13
- @enum.unique
14
- class Metric(enum.Enum):
15
- """List of supported metrics.
16
-
17
- AC energy metrics information:
18
- * This energy metric is reported directly from the component, and not a
19
- result of aggregations in our systems. If a component does not have this
20
- metric, this field cannot be populated.
21
- * Components that provide energy metrics reset this metric from time to
22
- time. This behaviour is specific to each component model. E.g., some
23
- components reset it on UTC 00:00:00.
24
- * This energy metric does not specify the timestamp since when the energy
25
- was being accumulated, and therefore can be inconsistent.
26
- """
27
-
28
- # Default value
29
- UNSPECIFIED = PBMetric.METRIC_UNSPECIFIED
30
-
31
- # DC electricity metrics
32
- DC_VOLTAGE = PBMetric.METRIC_DC_VOLTAGE
33
- DC_CURRENT = PBMetric.METRIC_DC_CURRENT
34
- DC_POWER = PBMetric.METRIC_DC_POWER
35
-
36
- # General AC electricity metrics
37
- AC_FREQUENCY = PBMetric.METRIC_AC_FREQUENCY
38
- AC_VOLTAGE = PBMetric.METRIC_AC_VOLTAGE
39
- AC_VOLTAGE_PHASE_1_N = PBMetric.METRIC_AC_VOLTAGE_PHASE_1_N
40
- AC_VOLTAGE_PHASE_2_N = PBMetric.METRIC_AC_VOLTAGE_PHASE_2_N
41
- AC_VOLTAGE_PHASE_3_N = PBMetric.METRIC_AC_VOLTAGE_PHASE_3_N
42
- AC_VOLTAGE_PHASE_1_PHASE_2 = PBMetric.METRIC_AC_VOLTAGE_PHASE_1_PHASE_2
43
- AC_VOLTAGE_PHASE_2_PHASE_3 = PBMetric.METRIC_AC_VOLTAGE_PHASE_2_PHASE_3
44
- AC_VOLTAGE_PHASE_3_PHASE_1 = PBMetric.METRIC_AC_VOLTAGE_PHASE_3_PHASE_1
45
- AC_CURRENT = PBMetric.METRIC_AC_CURRENT
46
- AC_CURRENT_PHASE_1 = PBMetric.METRIC_AC_CURRENT_PHASE_1
47
- AC_CURRENT_PHASE_2 = PBMetric.METRIC_AC_CURRENT_PHASE_2
48
- AC_CURRENT_PHASE_3 = PBMetric.METRIC_AC_CURRENT_PHASE_3
49
-
50
- # AC power metrics
51
- AC_POWER_APPARENT = PBMetric.METRIC_AC_POWER_APPARENT
52
- AC_POWER_APPARENT_PHASE_1 = PBMetric.METRIC_AC_POWER_APPARENT_PHASE_1
53
- AC_POWER_APPARENT_PHASE_2 = PBMetric.METRIC_AC_POWER_APPARENT_PHASE_2
54
- AC_POWER_APPARENT_PHASE_3 = PBMetric.METRIC_AC_POWER_APPARENT_PHASE_3
55
- AC_POWER_ACTIVE = PBMetric.METRIC_AC_POWER_ACTIVE
56
- AC_POWER_ACTIVE_PHASE_1 = PBMetric.METRIC_AC_POWER_ACTIVE_PHASE_1
57
- AC_POWER_ACTIVE_PHASE_2 = PBMetric.METRIC_AC_POWER_ACTIVE_PHASE_2
58
- AC_POWER_ACTIVE_PHASE_3 = PBMetric.METRIC_AC_POWER_ACTIVE_PHASE_3
59
- AC_POWER_REACTIVE = PBMetric.METRIC_AC_POWER_REACTIVE
60
- AC_POWER_REACTIVE_PHASE_1 = PBMetric.METRIC_AC_POWER_REACTIVE_PHASE_1
61
- AC_POWER_REACTIVE_PHASE_2 = PBMetric.METRIC_AC_POWER_REACTIVE_PHASE_2
62
- AC_POWER_REACTIVE_PHASE_3 = PBMetric.METRIC_AC_POWER_REACTIVE_PHASE_3
63
-
64
- # AC power factor
65
- AC_POWER_FACTOR = PBMetric.METRIC_AC_POWER_FACTOR
66
- AC_POWER_FACTOR_PHASE_1 = PBMetric.METRIC_AC_POWER_FACTOR_PHASE_1
67
- AC_POWER_FACTOR_PHASE_2 = PBMetric.METRIC_AC_POWER_FACTOR_PHASE_2
68
- AC_POWER_FACTOR_PHASE_3 = PBMetric.METRIC_AC_POWER_FACTOR_PHASE_3
69
-
70
- # AC energy metrics - Please be careful when using and check Enum docs
71
- AC_ENERGY_APPARENT = PBMetric.METRIC_AC_ENERGY_APPARENT
72
- AC_ENERGY_APPARENT_PHASE_1 = PBMetric.METRIC_AC_ENERGY_APPARENT_PHASE_1
73
- AC_ENERGY_APPARENT_PHASE_2 = PBMetric.METRIC_AC_ENERGY_APPARENT_PHASE_2
74
- AC_ENERGY_APPARENT_PHASE_3 = PBMetric.METRIC_AC_ENERGY_APPARENT_PHASE_3
75
- AC_ENERGY_ACTIVE = PBMetric.METRIC_AC_ENERGY_ACTIVE
76
- AC_ENERGY_ACTIVE_PHASE_1 = PBMetric.METRIC_AC_ENERGY_ACTIVE_PHASE_1
77
- AC_ENERGY_ACTIVE_PHASE_2 = PBMetric.METRIC_AC_ENERGY_ACTIVE_PHASE_2
78
- AC_ENERGY_ACTIVE_PHASE_3 = PBMetric.METRIC_AC_ENERGY_ACTIVE_PHASE_3
79
- AC_ENERGY_ACTIVE_CONSUMED = PBMetric.METRIC_AC_ENERGY_ACTIVE_CONSUMED
80
- AC_ENERGY_ACTIVE_CONSUMED_PHASE_1 = (
81
- PBMetric.METRIC_AC_ENERGY_ACTIVE_CONSUMED_PHASE_1
82
- )
83
- AC_ENERGY_ACTIVE_CONSUMED_PHASE_2 = (
84
- PBMetric.METRIC_AC_ENERGY_ACTIVE_CONSUMED_PHASE_2
85
- )
86
- AC_ENERGY_ACTIVE_CONSUMED_PHASE_3 = (
87
- PBMetric.METRIC_AC_ENERGY_ACTIVE_CONSUMED_PHASE_3
88
- )
89
- AC_ENERGY_ACTIVE_DELIVERED = PBMetric.METRIC_AC_ENERGY_ACTIVE_DELIVERED
90
- AC_ENERGY_ACTIVE_DELIVERED_PHASE_1 = (
91
- PBMetric.METRIC_AC_ENERGY_ACTIVE_DELIVERED_PHASE_1
92
- )
93
- AC_ENERGY_ACTIVE_DELIVERED_PHASE_2 = (
94
- PBMetric.METRIC_AC_ENERGY_ACTIVE_DELIVERED_PHASE_2
95
- )
96
- AC_ENERGY_ACTIVE_DELIVERED_PHASE_3 = (
97
- PBMetric.METRIC_AC_ENERGY_ACTIVE_DELIVERED_PHASE_3
98
- )
99
- AC_ENERGY_REACTIVE = PBMetric.METRIC_AC_ENERGY_REACTIVE
100
- AC_ENERGY_REACTIVE_PHASE_1 = PBMetric.METRIC_AC_ENERGY_REACTIVE_PHASE_1
101
- AC_ENERGY_REACTIVE_PHASE_2 = PBMetric.METRIC_AC_ENERGY_REACTIVE_PHASE_2
102
- AC_ENERGY_REACTIVE_PHASE_3 = PBMetric.METRIC_AC_ENERGY_REACTIVE_PHASE_3
103
-
104
- # AC harmonics
105
- AC_TOTAL_HARMONIC_DISTORTION_CURRENT = (
106
- PBMetric.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT
107
- )
108
- AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_1 = (
109
- PBMetric.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_1
110
- )
111
- AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_2 = (
112
- PBMetric.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_2
113
- )
114
- AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_3 = (
115
- PBMetric.METRIC_AC_TOTAL_HARMONIC_DISTORTION_CURRENT_PHASE_3
116
- )
117
-
118
- # General BMS metrics
119
- BATTERY_CAPACITY = PBMetric.METRIC_BATTERY_CAPACITY
120
- BATTERY_SOC_PCT = PBMetric.METRIC_BATTERY_SOC_PCT
121
- BATTERY_TEMPERATURE = PBMetric.METRIC_BATTERY_TEMPERATURE
122
-
123
- # General inverter metrics
124
- INVERTER_TEMPERATURE = PBMetric.METRIC_INVERTER_TEMPERATURE
125
- INVERTER_TEMPERATURE_CABINET = PBMetric.METRIC_INVERTER_TEMPERATURE_CABINET
126
- INVERTER_TEMPERATURE_HEATSINK = PBMetric.METRIC_INVERTER_TEMPERATURE_HEATSINK
127
- INVERTER_TEMPERATURE_TRANSFORMER = PBMetric.METRIC_INVERTER_TEMPERATURE_TRANSFORMER
128
-
129
- # EV charging station metrics
130
- EV_CHARGER_TEMPERATURE = PBMetric.METRIC_EV_CHARGER_TEMPERATURE
131
-
132
- # General sensor metrics
133
- SENSOR_WIND_SPEED = PBMetric.METRIC_SENSOR_WIND_SPEED
134
- SENSOR_WIND_DIRECTION = PBMetric.METRIC_SENSOR_WIND_DIRECTION
135
- SENSOR_TEMPERATURE = PBMetric.METRIC_SENSOR_TEMPERATURE
136
- SENSOR_RELATIVE_HUMIDITY = PBMetric.METRIC_SENSOR_RELATIVE_HUMIDITY
137
- SENSOR_DEW_POINT = PBMetric.METRIC_SENSOR_DEW_POINT
138
- SENSOR_AIR_PRESSURE = PBMetric.METRIC_SENSOR_AIR_PRESSURE
139
- SENSOR_IRRADIANCE = PBMetric.METRIC_SENSOR_IRRADIANCE
140
-
141
- @classmethod
142
- @deprecated("Use `frequenz.client.common.enum_proto.enum_from_proto` instead.")
143
- def from_proto(cls, metric: PBMetric.ValueType) -> Self:
144
- """Convert a protobuf Metric value to Metric enum.
145
-
146
- Args:
147
- metric: Metric to convert.
148
- Returns:
149
- Enum value corresponding to the protobuf message.
150
- """
151
- if not any(m.value == metric for m in cls):
152
- return cls(Metric.UNSPECIFIED)
153
-
154
- return cls(metric)
155
-
156
- def to_proto(self) -> PBMetric.ValueType:
157
- """Convert a Metric object to protobuf Metric.
158
-
159
- Returns:
160
- Protobuf message corresponding to the Metric object.
161
- """
162
- return self.value
@@ -1,18 +0,0 @@
1
- # License: MIT
2
- # Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3
-
4
- """Frequenz microgrid definition."""
5
-
6
- from typing import final
7
-
8
- from frequenz.core.id import BaseId
9
-
10
-
11
- @final
12
- class EnterpriseId(BaseId, str_prefix="EID"):
13
- """A unique identifier for an enterprise account."""
14
-
15
-
16
- @final
17
- class MicrogridId(BaseId, str_prefix="MID"):
18
- """A unique identifier for a microgrid."""
@@ -1,13 +0,0 @@
1
- # License: MIT
2
- # Copyright © 2025 Frequenz Energy-as-a-Service GmbH
3
-
4
- """Microgrid sensors."""
5
-
6
- from typing import final
7
-
8
- from frequenz.core.id import BaseId
9
-
10
-
11
- @final
12
- class SensorId(BaseId, str_prefix="SID"):
13
- """A unique identifier for a microgrid sensor."""