sensors_pb2
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2
¤
Generated protocol buffer code.
Attributes¤
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SENSOR_DIAGNOSTIC_CODE_INTERNAL
module-attribute
¤
Error indicating an internal error within the sensor.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SENSOR_DIAGNOSTIC_CODE_UNKNOWN
module-attribute
¤
The sensor is reporting an unknown or an undefined error, and the sender cannot parse the sensor error to any of the variants below.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SENSOR_DIAGNOSTIC_CODE_UNSPECIFIED
module-attribute
¤
Default value. No specific error is specified.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SENSOR_STATE_CODE_ERROR
module-attribute
¤
The sensor is in an error state.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SENSOR_STATE_CODE_OK
module-attribute
¤
The sensor is up and running.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SENSOR_STATE_CODE_UNSPECIFIED
module-attribute
¤
Default value when the sensor state is not explicitly set. This is the zero value of the enum.
Classes¤
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.Sensor
¤
Bases: Message
A sensor that measures a physical metric in the microgrid's surrounding environment.
Attributes¤
id
instance-attribute
¤
A unique identifier for the sensor.
manufacturer
instance-attribute
¤
The sensor manufacturer.
microgrid_id
instance-attribute
¤
Unique identifier of the parent microgrid_id.
model_name
instance-attribute
¤
The model name of the sensor.
name
instance-attribute
¤
An optional name for the sensor.
operational_lifetime
property
¤
The operational lifetime of the sensor.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SensorDiagnostic
¤
Bases: Message
Represents an error or warning condition reported by a microgrid sensor.
This message extends a standardized error code with contextual information useful for diagnostics, such as subsystem names, measured values, or vendor-specific insights.
Typical Sensor Error
Vendor-Specific Codes
When available, vendor_error_code
will reflect manufacturer-defined
error identifiers, typically exposed via Modbus or similar interfaces.
These codes are vendor- and firmware-specific and must be interpreted
using the vendor's official documentation.
Attributes¤
diagnostic_code
instance-attribute
¤
A standardized error code representing the category of the issue.
message
instance-attribute
¤
Optional human-readable message providing additional context.
vendor_diagnostic_code
instance-attribute
¤
Optional vendor-provided diagnostic code for the error, for vendor-specific insights or more granular diagnostics.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SensorDiagnosticCode
¤
Bases: _SensorDiagnosticCode
A representation of all possible warnings and errors that can occur in sensors.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SensorStateCode
¤
Bases: _SensorStateCode
Enum to represent the various states that a sensor can be in. This enum is unified across all sensor categories for consistency.
Source code in frequenz/api/common/v1alpha7/microgrid/sensors/sensors_pb2.py
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SensorStateSnapshot
¤
Bases: Message
Representation of a sensor state and errors.
Attributes¤
errors
property
¤
List of errors for the microgrid sensor.
Note
This list is treated as a set, and therefore its members will be unique, i.e., no state will exist twice in this list.
Note
This list is expected to have errors if and only if the sensor is in an error state.
origin_time
property
¤
The UTC time when the state was originally captured.
states
property
¤
List of states of the microgrid sensor.
Note
This list is treated as a set, and therefore its members will be unique, i.e., no state will exist twice in this list.
Note
If the state is SENSOR_STATE_CODE_ERROR
, the sensor is in an error
state. In such cases, the errors
field will be populated with the
list of errors.
warnings
property
¤
List of warnings for the microgrid sensor.
Note
This list is treated as a set, and therefore its members will be unique, i.e., no state will exist twice in this list.
Note
This list is expected to have warnings if and only if the sensor is reporting warnings.
frequenz.api.common.v1alpha7.microgrid.sensors.sensors_pb2.SensorTelemetry
¤
Bases: Message
SensorTelemetry message aggregates multiple metrics, operational states, and errors, related to a specific microgrid sensor.
Example
Example output of a component data message:
{
sensor_id: 13,
metric_samples: [
/* list of metrics for multiple timestamps */
{
sample_time: "2023-10-01T00:00:00Z",
metric: "METRIC_SENSOR_TEMPERATURE",
value: metric_value_variant: {simple_metric: {value: 23.5},
bounds: {}
connection: {}
},
{
sample_time: "2023-10-01T00:00:00Z",
metric: "METRIC_SENSOR_RELATIVE_HUMIDITY",
value: metric_value_variant: {simple_metric: {value: 23.5},
bounds: {}
connection: "humidity_sensor_1"
}
],
states: [
{
sample_time: "2023-10-01T00:00:00Z",
states: [],
errors: [],
},
]
}
Attributes¤
metric_samples
property
¤
List of measurements for a metric of the specific microgrid sensor.
Note that these metric samples will not necessarily contain bounds, since bounds are required for control operations, which are not applicable to sensors.
sensor_id
instance-attribute
¤
The ID of the microgrid sensors.
state_snapshots
property
¤
List of state snapshots of a specific microgrid sensor.