sensor
frequenz.client.microgrid.sensor ¤
Microgrid sensors.
This package provides classes and utilities for working with different types of
sensors in a microgrid environment. Sensors
measure various physical metrics in the surrounding environment, such as temperature,
humidity, and solar irradiance.
Sensor Telemetry¤
This package also provides several data structures for handling sensor readings and states:
SensorTelemetry: Represents a collection of measurements and states from a sensor at a specific point in time, including metric samples and state snapshots.SensorStateSnapshot: Contains the sensor's state codes and any associated diagnostic information.SensorDiagnostic: Represents a diagnostic message from a sensor, including an error code and optional additional information.SensorDiagnosticCode: Defines error codes that a sensor can report.SensorStateCode: Defines codes representing the operational state of a sensor.
Classes¤
frequenz.client.microgrid.sensor.Sensor
dataclass
¤
A sensor that measures physical metrics in the microgrid's surroundings.
Sensors are not part of the electrical infrastructure but provide environmental data such as temperature, humidity, and solar irradiance.
Source code in frequenz/client/microgrid/sensor/_sensor.py
Attributes¤
identity
property
¤
identity: tuple[SensorId, MicrogridId]
The identity of this sensor.
This uses the sensor ID and microgrid ID to identify a sensor without considering the other attributes, so even if a sensor state changed, the identity remains the same.
manufacturer
class-attribute
instance-attribute
¤
manufacturer: str | None = None
The sensor manufacturer.
microgrid_id
instance-attribute
¤
Unique identifier of the parent microgrid.
model_name
class-attribute
instance-attribute
¤
model_name: str | None = None
The model name of the sensor.
operational_lifetime
class-attribute
instance-attribute
¤
The operational lifetime of the sensor.
Functions¤
frequenz.client.microgrid.sensor.SensorDiagnostic
dataclass
¤
Diagnostic information for a sensor warning or error.
Provides detailed information about issues affecting a sensor.
Source code in frequenz/client/microgrid/sensor/_state.py
frequenz.client.microgrid.sensor.SensorDiagnosticCode ¤
Bases: Enum
Sensor diagnostic code.
Provides additional diagnostic information about warnings or errors.
Source code in frequenz/client/microgrid/sensor/_state.py
frequenz.client.microgrid.sensor.SensorStateCode ¤
Bases: Enum
Sensor state code.
Represents the operational state of a sensor.
Source code in frequenz/client/microgrid/sensor/_state.py
frequenz.client.microgrid.sensor.SensorStateSnapshot
dataclass
¤
A snapshot of a sensor's operational state at a specific time.
Contains the sensor's state codes and any associated diagnostic information.
Source code in frequenz/client/microgrid/sensor/_state.py
Attributes¤
errors
instance-attribute
¤
errors: Sequence[SensorDiagnostic]
Sequence of active errors with diagnostic information.
origin_time
instance-attribute
¤
origin_time: datetime
The timestamp when this state snapshot was recorded.
states
instance-attribute
¤
states: Set[SensorStateCode | int]
Set of state codes active at the snapshot time.
warnings
instance-attribute
¤
warnings: Sequence[SensorDiagnostic]
Sequence of active warnings with diagnostic information.
frequenz.client.microgrid.sensor.SensorTelemetry
dataclass
¤
Telemetry data from a sensor.
Contains metric measurements and state snapshots for a specific sensor.
Source code in frequenz/client/microgrid/sensor/_telemetry.py
Attributes¤
metric_samples
instance-attribute
¤
metric_samples: Sequence[MetricSample]
List of metric measurements from the sensor.
sensor_id
instance-attribute
¤
The unique identifier of the sensor that produced this telemetry.
state_snapshots
instance-attribute
¤
state_snapshots: Sequence[SensorStateSnapshot]
List of state snapshots indicating the sensor's operational status.