3535from datetime import datetime
3636from typing import assert_never
3737
38+ from frequenz .api .microgrid import sensor_pb2
39+
3840from ._lifetime import Lifetime
3941from .id import SensorId
4042from .metrics import AggregatedMetricValue , AggregationMethod
@@ -83,31 +85,31 @@ class SensorMetric(enum.Enum):
8385 environmental conditions and physical measurements.
8486 """
8587
86- UNSPECIFIED = 0
88+ UNSPECIFIED = sensor_pb2 . SENSOR_METRIC_UNSPECIFIED
8789 """Default value (this should not be normally used and usually indicates an issue)."""
8890
89- TEMPERATURE = 1
91+ TEMPERATURE = sensor_pb2 . SENSOR_METRIC_TEMPERATURE
9092 """Temperature, in Celsius (°C)."""
9193
92- HUMIDITY = 2
94+ HUMIDITY = sensor_pb2 . SENSOR_METRIC_HUMIDITY
9395 """Humidity, in percentage (%)."""
9496
95- PRESSURE = 3
97+ PRESSURE = sensor_pb2 . SENSOR_METRIC_PRESSURE
9698 """Pressure, in Pascal (Pa)."""
9799
98- IRRADIANCE = 4
100+ IRRADIANCE = sensor_pb2 . SENSOR_METRIC_IRRADIANCE
99101 """Irradiance / Radiation flux, in watts per square meter (W / m²)."""
100102
101- VELOCITY = 5
103+ VELOCITY = sensor_pb2 . SENSOR_METRIC_VELOCITY
102104 """Velocity, in meters per second (m / s)."""
103105
104- ACCELERATION = 6
106+ ACCELERATION = sensor_pb2 . SENSOR_METRIC_ACCELERATION
105107 """Acceleration in meters per second per second (m / s²)."""
106108
107- ANGLE = 7
109+ ANGLE = sensor_pb2 . SENSOR_METRIC_ANGLE
108110 """Angle, in degrees with respect to the (magnetic) North (°)."""
109111
110- DEW_POINT = 8
112+ DEW_POINT = sensor_pb2 . SENSOR_METRIC_DEW_POINT
111113 """Dew point, in Celsius (°C).
112114
113115 The temperature at which the air becomes saturated with water vapor.
@@ -118,33 +120,23 @@ class SensorMetric(enum.Enum):
118120class SensorStateCode (enum .Enum ):
119121 """The various states that a sensor can be in."""
120122
121- UNSPECIFIED = 0
123+ UNSPECIFIED = sensor_pb2 . COMPONENT_STATE_UNSPECIFIED
122124 """Default value (this should not be normally used and usually indicates an issue)."""
123125
124- ON = 1
126+ ON = sensor_pb2 . COMPONENT_STATE_OK
125127 """The sensor is up and running."""
126128
127- ERROR = 2
129+ ERROR = sensor_pb2 . COMPONENT_STATE_ERROR
128130 """The sensor is in an error state."""
129131
130132
131133@enum .unique
132134class SensorErrorCode (enum .Enum ):
133135 """The various errors that can occur in sensors."""
134136
135- UNSPECIFIED = 0
137+ UNSPECIFIED = sensor_pb2 . ERROR_CODE_UNSPECIFIED
136138 """Default value (this should not be normally used and usually indicates an issue)."""
137139
138- UNKNOWN = 1
139- """An unknown or undefined error.
140-
141- This is used when the error can be retrieved from the sensor but it doesn't match
142- any known error or can't be interpreted for some reason.
143- """
144-
145- INTERNAL = 2
146- """An internal error within the sensor."""
147-
148140
149141@dataclass (frozen = True , kw_only = True )
150142class SensorStateSample :
0 commit comments