microgrid
frequenz.client.microgrid ¤
Client to connect to the Microgrid API.
This package provides a low-level interface for interacting with the microgrid API.
Classes¤
frequenz.client.microgrid.ApiClientError ¤
Bases: Exception
There was an error in an API client.
To simplify retrying, errors are classified as retryable, or not. Retryable errors might succeed if retried, while permanent errors won't. When uncertain, errors are assumed to be retryable.
The following sub-classes are available:
- GrpcError: A gRPC operation failed.
Source code in frequenz/client/base/exception.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|
Attributes¤
description
instance-attribute
¤
description = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
description
|
A human-readable description of the error.
TYPE:
|
retryable
|
Whether retrying the operation might succeed.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.BatteryComponentState ¤
Bases: Enum
Component states of a battery.
Source code in frequenz/client/microgrid/_component_states.py
Attributes¤
CHARGING
class-attribute
instance-attribute
¤
The battery is consuming electrical energy.
DISCHARGING
class-attribute
instance-attribute
¤
The battery is generating electrical energy.
ERROR
class-attribute
instance-attribute
¤
The battery is in a faulty state.
LOCKED
class-attribute
instance-attribute
¤
The battery is online, but currently unavailable.
Possibly due to a pre-scheduled maintenance, or waiting for a resource to be loaded.
SWITCHING_OFF
class-attribute
instance-attribute
¤
The battery is switching off and needs some time to fully shut down.
SWITCHING_ON
class-attribute
instance-attribute
¤
The battery is starting up and needs some time to become fully operational.
UNKNOWN
class-attribute
instance-attribute
¤
A state is provided by the component, but it is not one of the above states.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified component state.
Functions¤
from_pb
classmethod
¤
from_pb(state: ValueType) -> Self
Convert a protobuf state value to this enum.
PARAMETER | DESCRIPTION |
---|---|
state
|
The protobuf component state to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_states.py
frequenz.client.microgrid.BatteryData
dataclass
¤
Bases: ComponentData
A wrapper class for holding battery data.
Source code in frequenz/client/microgrid/_component_data.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
|
Attributes¤
component_id
instance-attribute
¤
component_id: int
The ID identifying this component in the microgrid.
power_exclusion_lower_bound
instance-attribute
¤
power_exclusion_lower_bound: float
Lower exclusion bound for battery power in watts.
This is the lower limit of the range within which power requests are not allowed for the battery.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
power_exclusion_upper_bound
instance-attribute
¤
power_exclusion_upper_bound: float
Upper exclusion bound for battery power in watts.
This is the upper limit of the range within which power requests are not allowed for the battery.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
power_inclusion_lower_bound
instance-attribute
¤
power_inclusion_lower_bound: float
Lower inclusion bound for battery power in watts.
This is the lower limit of the range within which power requests are allowed for the battery.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
power_inclusion_upper_bound
instance-attribute
¤
power_inclusion_upper_bound: float
Upper inclusion bound for battery power in watts.
This is the upper limit of the range within which power requests are allowed for the battery.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
raw
class-attribute
instance-attribute
¤
raw: ComponentData | None = field(default=None, init=False)
Raw component data as decoded from the wire.
soc_lower_bound
instance-attribute
¤
soc_lower_bound: float
The SoC below which discharge commands will be blocked by the system, in percent (%).
soc_upper_bound
instance-attribute
¤
soc_upper_bound: float
The SoC above which charge commands will be blocked by the system, in percent (%).
temperature
instance-attribute
¤
temperature: float
The (average) temperature reported by the battery, in Celsius (°C).
Functions¤
from_proto
classmethod
¤
from_proto(raw: ComponentData) -> Self
Create BatteryData from a protobuf message.
PARAMETER | DESCRIPTION |
---|---|
raw
|
raw component data as decoded from the wire.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Instance of BatteryData created from the protobuf message. |
Source code in frequenz/client/microgrid/_component_data.py
frequenz.client.microgrid.BatteryError
dataclass
¤
A battery error.
Source code in frequenz/client/microgrid/_component_error.py
Attributes¤
Functions¤
from_pb
classmethod
¤
Create a new instance using a protobuf message to get the values.
PARAMETER | DESCRIPTION |
---|---|
raw
|
The protobuf message to get the values from.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The new instance with the values from the protobuf message. |
Source code in frequenz/client/microgrid/_component_error.py
frequenz.client.microgrid.BatteryErrorCode ¤
Bases: Enum
Battery error code.
Source code in frequenz/client/microgrid/_component_error.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
|
Attributes¤
BLOCK_ERROR
class-attribute
instance-attribute
¤
One or more battery blocks have failed.
CALIBRATION_NEEDED
class-attribute
instance-attribute
¤
The battery requires a calibration to reset its measurements.
CONTROLLER_ERROR
class-attribute
instance-attribute
¤
The battery controller has failed.
EXCEEDED_SOP_CHARGE
class-attribute
instance-attribute
¤
Charge current has exceeded component bounds.
EXCEEDED_SOP_DISCHARGE
class-attribute
instance-attribute
¤
Discharge current has exceeded component bounds.
EXTERNAL_POWER_SWITCH_ERROR
class-attribute
instance-attribute
¤
The eternal power switch has failed.
FUSE_ERROR
class-attribute
instance-attribute
¤
The battery's fuse has failed.
HIGH_CURRENT_CHARGE
class-attribute
instance-attribute
¤
Charge current is too high.
HIGH_CURRENT_DISCHARGE
class-attribute
instance-attribute
¤
Discharge current is too high.
HIGH_HUMIDITY
class-attribute
instance-attribute
¤
Humidity is too high.
HIGH_TEMPERATURE
class-attribute
instance-attribute
¤
Temperature is too high.
HIGH_VOLTAGE
class-attribute
instance-attribute
¤
Voltage is too high.
LOW_SOH
class-attribute
instance-attribute
¤
The State of health is low.
LOW_TEMPERATURE
class-attribute
instance-attribute
¤
Temperature is too low.
LOW_VOLTAGE
class-attribute
instance-attribute
¤
Voltage is too low.
PRECHARGE_ERROR
class-attribute
instance-attribute
¤
The precharge operation has failed.
RELAY_CYCLE_LIMIT_REACHED
class-attribute
instance-attribute
¤
The battery's DC relays have reached the cycles limit in its lifetime specifications.
RELAY_ERROR
class-attribute
instance-attribute
¤
The battery's DC relays have failed.
SYSTEM_IMBALANCE
class-attribute
instance-attribute
¤
The battery blocks are not balanced with respect to each other.
SYSTEM_PLAUSIBILITY_ERROR
class-attribute
instance-attribute
¤
System plausibility checks have failed.
SYSTEM_UNDERVOLTAGE_SHUTDOWN
class-attribute
instance-attribute
¤
System shut down due to extremely low voltage.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified battery error code.
Functions¤
from_pb
classmethod
¤
from_pb(code: ValueType) -> Self
Convert a protobuf error code value to this enum.
PARAMETER | DESCRIPTION |
---|---|
code
|
The protobuf error code to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_error.py
frequenz.client.microgrid.BatteryRelayState ¤
Bases: Enum
Relay states of a battery.
Source code in frequenz/client/microgrid/_component_states.py
Attributes¤
CLOSED
class-attribute
instance-attribute
¤
The relays are closed, and the DC power line to the inverter is connected.
ERROR
class-attribute
instance-attribute
¤
The relays are in an error state.
LOCKED
class-attribute
instance-attribute
¤
The relays are locked, and should be available to accept commands shortly.
OPENED
class-attribute
instance-attribute
¤
The relays are open, and the DC power line to the inverter is disconnected.
PRECHARGING
class-attribute
instance-attribute
¤
The relays are closing, and the DC power line to the inverter is being connected.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified relay state.
Functions¤
from_pb
classmethod
¤
from_pb(state: ValueType) -> Self
Convert a protobuf state value to this enum.
PARAMETER | DESCRIPTION |
---|---|
state
|
The protobuf component state to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_states.py
frequenz.client.microgrid.ClientNotConnected ¤
Bases: ApiClientError
The client is not connected to the server.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.Component
dataclass
¤
Metadata for a single microgrid component.
Source code in frequenz/client/microgrid/_component.py
Attributes¤
metadata
class-attribute
instance-attribute
¤
metadata: ComponentMetadata | None = None
The metadata of this component.
type
class-attribute
instance-attribute
¤
type: ComponentType | None = None
The type of this component.
Functions¤
__hash__ ¤
__hash__() -> int
Compute a hash of this instance, obtained by hashing the component_id
field.
RETURNS | DESCRIPTION |
---|---|
int
|
Hash of this instance. |
is_valid ¤
is_valid() -> bool
Check if this instance contains valid data.
RETURNS | DESCRIPTION |
---|---|
bool
|
|
Source code in frequenz/client/microgrid/_component.py
frequenz.client.microgrid.ComponentCategory ¤
Bases: Enum
Possible types of microgrid component.
Source code in frequenz/client/microgrid/_component.py
frequenz.client.microgrid.ComponentData
dataclass
¤
Bases: ABC
A private base class for strongly typed component data classes.
Source code in frequenz/client/microgrid/_component_data.py
Attributes¤
component_id
instance-attribute
¤
component_id: int
The ID identifying this component in the microgrid.
raw
class-attribute
instance-attribute
¤
raw: ComponentData | None = field(default=None, init=False)
Raw component data as decoded from the wire.
Functions¤
from_proto
abstractmethod
classmethod
¤
from_proto(raw: ComponentData) -> Self
Create ComponentData from a protobuf message.
PARAMETER | DESCRIPTION |
---|---|
raw
|
raw component data as decoded from the wire.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The instance created from the protobuf message. |
Source code in frequenz/client/microgrid/_component_data.py
frequenz.client.microgrid.ComponentMetadata
dataclass
¤
Base class for component metadata classes.
Source code in frequenz/client/microgrid/_component.py
frequenz.client.microgrid.ComponentMetricId ¤
Bases: Enum
An enum representing the various metrics available in the microgrid.
Source code in frequenz/client/microgrid/_component.py
Attributes¤
ACTIVE_POWER_EXCLUSION_LOWER_BOUND
class-attribute
instance-attribute
¤
Active power exclusion lower bound.
ACTIVE_POWER_EXCLUSION_UPPER_BOUND
class-attribute
instance-attribute
¤
Active power exclusion upper bound.
ACTIVE_POWER_INCLUSION_LOWER_BOUND
class-attribute
instance-attribute
¤
Active power inclusion lower bound.
ACTIVE_POWER_INCLUSION_UPPER_BOUND
class-attribute
instance-attribute
¤
Active power inclusion upper bound.
ACTIVE_POWER_PHASE_1
class-attribute
instance-attribute
¤
Active power in phase 1.
ACTIVE_POWER_PHASE_2
class-attribute
instance-attribute
¤
Active power in phase 2.
ACTIVE_POWER_PHASE_3
class-attribute
instance-attribute
¤
Active power in phase 3.
CURRENT_PHASE_1
class-attribute
instance-attribute
¤
Current in phase 1.
CURRENT_PHASE_2
class-attribute
instance-attribute
¤
Current in phase 2.
CURRENT_PHASE_3
class-attribute
instance-attribute
¤
Current in phase 3.
POWER_EXCLUSION_LOWER_BOUND
class-attribute
instance-attribute
¤
Power exclusion lower bound.
POWER_EXCLUSION_UPPER_BOUND
class-attribute
instance-attribute
¤
Power exclusion upper bound.
POWER_INCLUSION_LOWER_BOUND
class-attribute
instance-attribute
¤
Power inclusion lower bound.
POWER_INCLUSION_UPPER_BOUND
class-attribute
instance-attribute
¤
Power inclusion upper bound.
REACTIVE_POWER
class-attribute
instance-attribute
¤
Reactive power.
REACTIVE_POWER_PHASE_1
class-attribute
instance-attribute
¤
Reactive power in phase 1.
REACTIVE_POWER_PHASE_2
class-attribute
instance-attribute
¤
Reactive power in phase 2.
REACTIVE_POWER_PHASE_3
class-attribute
instance-attribute
¤
Reactive power in phase 3.
SOC_LOWER_BOUND
class-attribute
instance-attribute
¤
Lower bound of state of charge.
SOC_UPPER_BOUND
class-attribute
instance-attribute
¤
Upper bound of state of charge.
VOLTAGE_PHASE_1
class-attribute
instance-attribute
¤
Voltage in phase 1.
VOLTAGE_PHASE_2
class-attribute
instance-attribute
¤
Voltage in phase 2.
VOLTAGE_PHASE_3
class-attribute
instance-attribute
¤
Voltage in phase 3.
frequenz.client.microgrid.ComponentType ¤
frequenz.client.microgrid.Connection
dataclass
¤
Metadata for a connection between microgrid components.
Source code in frequenz/client/microgrid/_connection.py
Attributes¤
end
instance-attribute
¤
end: int
The component ID that represents the end component of the connection.
start
instance-attribute
¤
start: int
The component ID that represents the start component of the connection.
Functions¤
frequenz.client.microgrid.DataLoss ¤
Bases: GrpcError
Unrecoverable data loss or corruption.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.EVChargerCableState ¤
Bases: Enum
Cable states of an EV Charger.
Source code in frequenz/client/microgrid/_component_states.py
Attributes¤
CHARGING_STATION_LOCKED
class-attribute
instance-attribute
¤
The cable is plugged into the charging station and locked.
CHARGING_STATION_PLUGGED
class-attribute
instance-attribute
¤
The cable is plugged into the charging station.
EV_LOCKED
class-attribute
instance-attribute
¤
The cable is plugged into the EV and locked.
EV_PLUGGED
class-attribute
instance-attribute
¤
The cable is plugged into the EV.
UNPLUGGED
class-attribute
instance-attribute
¤
The cable is unplugged.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified cable state.
Functions¤
from_pb
classmethod
¤
from_pb(state: ValueType) -> Self
Convert a protobuf state value to this enum.
PARAMETER | DESCRIPTION |
---|---|
state
|
The protobuf cable state to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_states.py
frequenz.client.microgrid.EVChargerComponentState ¤
Bases: Enum
Component State of an EV Charger.
Source code in frequenz/client/microgrid/_component_states.py
Attributes¤
AUTHORIZATION_REJECTED
class-attribute
instance-attribute
¤
The component rejected authorization.
CHARGING
class-attribute
instance-attribute
¤
The component is charging.
DISCHARGING
class-attribute
instance-attribute
¤
The component is discharging.
ERROR
class-attribute
instance-attribute
¤
The component is in error state.
INTERRUPTED
class-attribute
instance-attribute
¤
The component is interrupted.
NOT_READY
class-attribute
instance-attribute
¤
The component is not ready.
STARTING
class-attribute
instance-attribute
¤
The component is starting.
UNKNOWN
class-attribute
instance-attribute
¤
A state is provided by the component, but it is not one of the above states.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified component state.
Functions¤
from_pb
classmethod
¤
from_pb(state: ValueType) -> Self
Convert a protobuf state value to this enum.
PARAMETER | DESCRIPTION |
---|---|
state
|
The protobuf component state to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_states.py
frequenz.client.microgrid.EVChargerData
dataclass
¤
Bases: ComponentData
A wrapper class for holding ev_charger data.
Source code in frequenz/client/microgrid/_component_data.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
|
Attributes¤
active_power
instance-attribute
¤
active_power: float
The total active 3-phase AC power, in Watts (W).
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
active_power_exclusion_lower_bound
instance-attribute
¤
active_power_exclusion_lower_bound: float
Lower exclusion bound for EV charger power in watts.
This is the lower limit of the range within which power requests are not allowed for the EV charger.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_exclusion_upper_bound
instance-attribute
¤
active_power_exclusion_upper_bound: float
Upper exclusion bound for EV charger power in watts.
This is the upper limit of the range within which power requests are not allowed for the EV charger.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_inclusion_lower_bound
instance-attribute
¤
active_power_inclusion_lower_bound: float
Lower inclusion bound for EV charger power in watts.
This is the lower limit of the range within which power requests are allowed for the EV charger.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_inclusion_upper_bound
instance-attribute
¤
active_power_inclusion_upper_bound: float
Upper inclusion bound for EV charger power in watts.
This is the upper limit of the range within which power requests are allowed for the EV charger.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_per_phase
instance-attribute
¤
The per-phase AC active power for phase 1, 2, and 3 respectively, in Watt (W).
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
cable_state
instance-attribute
¤
cable_state: EVChargerCableState
The state of the ev charger's cable.
component_id
instance-attribute
¤
component_id: int
The ID identifying this component in the microgrid.
component_state
instance-attribute
¤
component_state: EVChargerComponentState
The state of the ev charger.
current_per_phase
instance-attribute
¤
AC current in Amperes (A) for phase/line 1,2 and 3 respectively.
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
raw
class-attribute
instance-attribute
¤
raw: ComponentData | None = field(default=None, init=False)
Raw component data as decoded from the wire.
reactive_power
instance-attribute
¤
reactive_power: float
The total reactive 3-phase AC power, in Volt-Ampere Reactive (VAr).
- Positive power means capacitive (current leading w.r.t. voltage).
- Negative power means inductive (current lagging w.r.t. voltage).
reactive_power_per_phase
instance-attribute
¤
The per-phase AC reactive power, in Volt-Ampere Reactive (VAr).
The provided values are for phase 1, 2, and 3 respectively.
- Positive power means capacitive (current leading w.r.t. voltage).
- Negative power means inductive (current lagging w.r.t. voltage).
voltage_per_phase
instance-attribute
¤
The AC voltage in Volts (V) between the line and the neutral wire for phase/line 1,2 and 3 respectively.
Functions¤
from_proto
classmethod
¤
from_proto(raw: ComponentData) -> Self
Create EVChargerData from a protobuf message.
PARAMETER | DESCRIPTION |
---|---|
raw
|
raw component data as decoded from the wire.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Instance of EVChargerData created from the protobuf message. |
Source code in frequenz/client/microgrid/_component_data.py
is_ev_connected ¤
is_ev_connected() -> bool
Check whether an EV is connected to the charger.
RETURNS | DESCRIPTION |
---|---|
bool
|
When the charger is not in an error state, whether an EV is connected to the charger. |
Source code in frequenz/client/microgrid/_component_data.py
frequenz.client.microgrid.EntityAlreadyExists ¤
Bases: GrpcError
The entity that we attempted to create already exists.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.EntityNotFound ¤
Bases: GrpcError
The requested entity was not found.
Note that this error differs from PermissionDenied. This error is used when the requested entity is not found, regardless of the user's permissions.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.ErrorLevel ¤
Bases: Enum
Error level.
Source code in frequenz/client/microgrid/_component_error.py
Attributes¤
CRITICAL
class-attribute
instance-attribute
¤
A severe error that causes the component to fail. Immediate action must be taken.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified component error.
WARN
class-attribute
instance-attribute
¤
Action must be taken to prevent a severe error from occurring in the future.
Functions¤
from_pb
classmethod
¤
from_pb(code: ValueType) -> Self
Convert a protobuf error level value to this enum.
PARAMETER | DESCRIPTION |
---|---|
code
|
The protobuf error level to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_error.py
frequenz.client.microgrid.Fuse
dataclass
¤
frequenz.client.microgrid.GridMetadata
dataclass
¤
Bases: ComponentMetadata
Metadata for a grid connection point.
Source code in frequenz/client/microgrid/_component.py
frequenz.client.microgrid.GrpcError ¤
Bases: ApiClientError
The gRPC server returned an error with a status code.
These errors are specific to gRPC. If you want to use the client in a protocol-independent way, you should avoid catching this exception. Catching subclasses that don't have grpc in their name should be protocol-independent.
The following sub-classes are available:
- DataLoss: Unrecoverable data loss or corruption.
- EntityAlreadyExists: The entity that we attempted to create already exists.
- EntityNotFound: The requested entity was not found.
- InternalError: Some invariants expected by the underlying system have been broken.
- InvalidArgument: The client specified an invalid argument.
- OperationAborted: The operation was aborted.
- OperationCancelled: The operation was cancelled.
- OperationNotImplemented: The operation is not implemented or not supported/enabled in this service.
- OperationOutOfRange: The operation was attempted past the valid range.
- OperationPreconditionFailed: The operation was rejected because the system is not in a required state.
- OperationTimedOut: The time limit was exceeded while waiting for the operation to complete.
- OperationUnauthenticated: The request does not have valid authentication credentials for the operation.
- PermissionDenied: The caller does not have permission to execute the specified operation.
- ResourceExhausted: Some resource has been exhausted (for example per-user quota, disk space, etc.).
- ServiceUnavailable: The service is currently unavailable.
- UnknownError: There was an error that can't be described using other statuses.
- UnrecognizedGrpcStatus: The gRPC server returned an unrecognized status code.
References
Source code in frequenz/client/base/exception.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 |
|
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
description: str,
grpc_error: AioRpcError,
retryable: bool
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
description
|
A human-readable description of the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
retryable
|
Whether retrying the operation might succeed.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.InternalError ¤
Bases: GrpcError
Some invariants expected by the underlying system have been broken.
This error code is reserved for serious errors.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.InvalidArgument ¤
Bases: GrpcError
, ValueError
The client specified an invalid argument.
Note that this error differs from OperationPreconditionFailed. This error indicates arguments that are problematic regardless of the state of the system (e.g., a malformed file name).
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.InverterComponentState ¤
Bases: Enum
Component states of an inverter.
Source code in frequenz/client/microgrid/_component_states.py
Attributes¤
CHARGING
class-attribute
instance-attribute
¤
The inverter is consuming electrical energy to charge batteries.
Applicable to BATTERY
and HYBRID
inverters only.
DISCHARGING
class-attribute
instance-attribute
¤
The inverter is generating electrical energy.
ERROR
class-attribute
instance-attribute
¤
The inverter is in a faulty state.
STANDBY
class-attribute
instance-attribute
¤
The PbInverteris in a standby state, and is disconnected from the grid.
When connected to the grid, it run a few tests, and move to the IDLE
state.
SWITCHING_OFF
class-attribute
instance-attribute
¤
The PbInverteris switching off and needs some time to fully shut down.
SWITCHING_ON
class-attribute
instance-attribute
¤
The PbInverteris starting up and needs some time to become fully operational.
UNAVAILABLE
class-attribute
instance-attribute
¤
The inverter is online, but currently unavailable.
Possibly due to a pre- scheduled maintenance.
UNKNOWN
class-attribute
instance-attribute
¤
A state is provided by the component, but it is not one of the above states.
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified component state.
Functions¤
from_pb
classmethod
¤
from_pb(state: ValueType) -> Self
Convert a protobuf state value to this enum.
PARAMETER | DESCRIPTION |
---|---|
state
|
The protobuf component state to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_states.py
frequenz.client.microgrid.InverterData
dataclass
¤
Bases: ComponentData
A wrapper class for holding inverter data.
Source code in frequenz/client/microgrid/_component_data.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
Attributes¤
active_power
instance-attribute
¤
active_power: float
The total active 3-phase AC power, in Watts (W).
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
active_power_exclusion_lower_bound
instance-attribute
¤
active_power_exclusion_lower_bound: float
Lower exclusion bound for inverter power in watts.
This is the lower limit of the range within which power requests are not allowed for the inverter.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_exclusion_upper_bound
instance-attribute
¤
active_power_exclusion_upper_bound: float
Upper exclusion bound for inverter power in watts.
This is the upper limit of the range within which power requests are not allowed for the inverter.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_inclusion_lower_bound
instance-attribute
¤
active_power_inclusion_lower_bound: float
Lower inclusion bound for inverter power in watts.
This is the lower limit of the range within which power requests are allowed for the inverter.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_inclusion_upper_bound
instance-attribute
¤
active_power_inclusion_upper_bound: float
Upper inclusion bound for inverter power in watts.
This is the upper limit of the range within which power requests are allowed for the inverter.
See frequenz.api.common.metrics_pb2.Metric.system_inclusion_bounds
and
frequenz.api.common.metrics_pb2.Metric.system_exclusion_bounds
for more
details.
active_power_per_phase
instance-attribute
¤
The per-phase AC active power for phase 1, 2, and 3 respectively, in Watt (W).
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
component_id
instance-attribute
¤
component_id: int
The ID identifying this component in the microgrid.
current_per_phase
instance-attribute
¤
AC current in Amperes (A) for phase/line 1, 2 and 3 respectively.
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
raw
class-attribute
instance-attribute
¤
raw: ComponentData | None = field(default=None, init=False)
Raw component data as decoded from the wire.
reactive_power
instance-attribute
¤
reactive_power: float
The total reactive 3-phase AC power, in Volt-Ampere Reactive (VAr).
- Positive power means capacitive (current leading w.r.t. voltage).
- Negative power means inductive (current lagging w.r.t. voltage).
reactive_power_per_phase
instance-attribute
¤
The per-phase AC reactive power, in Volt-Ampere Reactive (VAr).
The provided values are for phase 1, 2, and 3 respectively.
- Positive power means capacitive (current leading w.r.t. voltage).
- Negative power means inductive (current lagging w.r.t. voltage).
voltage_per_phase
instance-attribute
¤
The AC voltage in Volts (V) between the line and the neutral wire for phase/line 1, 2 and 3 respectively.
Functions¤
from_proto
classmethod
¤
from_proto(raw: ComponentData) -> Self
Create InverterData from a protobuf message.
PARAMETER | DESCRIPTION |
---|---|
raw
|
raw component data as decoded from the wire.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Instance of InverterData created from the protobuf message. |
Source code in frequenz/client/microgrid/_component_data.py
frequenz.client.microgrid.InverterError
dataclass
¤
An inverter error.
Source code in frequenz/client/microgrid/_component_error.py
Attributes¤
Functions¤
from_pb
classmethod
¤
Create a new instance using a protobuf message to get the values.
PARAMETER | DESCRIPTION |
---|---|
raw
|
The protobuf message to get the values from.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The new instance with the values from the protobuf message. |
Source code in frequenz/client/microgrid/_component_error.py
frequenz.client.microgrid.InverterErrorCode ¤
Bases: Enum
Inverter error code.
Source code in frequenz/client/microgrid/_component_error.py
Attributes¤
UNSPECIFIED
class-attribute
instance-attribute
¤
Unspecified inverter error code.
Functions¤
from_pb
classmethod
¤
from_pb(code: ValueType) -> Self
Convert a protobuf error code value to this enum.
PARAMETER | DESCRIPTION |
---|---|
code
|
The protobuf error code to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
The enum value corresponding to the protobuf message. |
Source code in frequenz/client/microgrid/_component_error.py
frequenz.client.microgrid.InverterType ¤
Bases: ComponentType
Enum representing inverter types.
Source code in frequenz/client/microgrid/_component.py
Attributes¤
frequenz.client.microgrid.Location
dataclass
¤
Metadata for the location of microgrid.
Source code in frequenz/client/microgrid/_metadata.py
Attributes¤
latitude
class-attribute
instance-attribute
¤
latitude: float | None = None
The latitude of the microgrid in degree.
longitude
class-attribute
instance-attribute
¤
longitude: float | None = None
The longitude of the microgrid in degree.
timezone
class-attribute
instance-attribute
¤
timezone: ZoneInfo | None = None
The timezone of the microgrid.
If not passed during construction (or None
is passed), and there is a longitude
and latitude
, then the timezone wil be looked up in a database based on the
coordinates. This lookup could fail, in which case the timezone will still be
None
.
Functions¤
__post_init__ ¤
Initialize the timezone of the microgrid.
Source code in frequenz/client/microgrid/_metadata.py
frequenz.client.microgrid.Metadata
dataclass
¤
Metadata for the microgrid.
Source code in frequenz/client/microgrid/_metadata.py
frequenz.client.microgrid.MeterData
dataclass
¤
Bases: ComponentData
A wrapper class for holding meter data.
Source code in frequenz/client/microgrid/_component_data.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
Attributes¤
active_power
instance-attribute
¤
active_power: float
The total active 3-phase AC power, in Watts (W).
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
active_power_per_phase
instance-attribute
¤
The per-phase AC active power for phase 1, 2, and 3 respectively, in Watt (W).
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
component_id
instance-attribute
¤
component_id: int
The ID identifying this component in the microgrid.
current_per_phase
instance-attribute
¤
AC current in Amperes (A) for phase/line 1,2 and 3 respectively.
Represented in the passive sign convention.
- Positive means consumption from the grid.
- Negative means supply into the grid.
raw
class-attribute
instance-attribute
¤
raw: ComponentData | None = field(default=None, init=False)
Raw component data as decoded from the wire.
reactive_power
instance-attribute
¤
reactive_power: float
The total reactive 3-phase AC power, in Volt-Ampere Reactive (VAr).
- Positive power means capacitive (current leading w.r.t. voltage).
- Negative power means inductive (current lagging w.r.t. voltage).
reactive_power_per_phase
instance-attribute
¤
The per-phase AC reactive power, in Volt-Ampere Reactive (VAr).
The provided values are for phase 1, 2, and 3 respectively.
- Positive power means capacitive (current leading w.r.t. voltage).
- Negative power means inductive (current lagging w.r.t. voltage).
voltage_per_phase
instance-attribute
¤
The ac voltage in volts (v) between the line and the neutral wire for phase/line 1,2 and 3 respectively.
Functions¤
from_proto
classmethod
¤
from_proto(raw: ComponentData) -> Self
Create MeterData from a protobuf message.
PARAMETER | DESCRIPTION |
---|---|
raw
|
raw component data as decoded from the wire.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Self
|
Instance of MeterData created from the protobuf message. |
Source code in frequenz/client/microgrid/_component_data.py
frequenz.client.microgrid.MicrogridApiClient ¤
Bases: BaseApiClient[MicrogridStub]
A microgrid API client.
Source code in frequenz/client/microgrid/_client.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 |
|
Attributes¤
channel
property
¤
channel: Channel
The underlying gRPC channel used to communicate with the server.
Warning
This channel is provided as a last resort for advanced users. It is not recommended to use this property directly unless you know what you are doing and you don't care about being tied to a specific gRPC library.
RAISES | DESCRIPTION |
---|---|
ClientNotConnected
|
If the client is not connected to the server. |
channel_defaults
property
¤
The default options for the gRPC channel.
Functions¤
__aexit__
async
¤
__aexit__(
_exc_type: type[BaseException] | None,
_exc_val: BaseException | None,
_exc_tb: Any | None,
) -> bool | None
Exit a context manager.
Source code in frequenz/client/base/client.py
__init__ ¤
__init__(
server_url: str,
*,
channel_defaults: ChannelOptions = DEFAULT_CHANNEL_OPTIONS,
connect: bool = True,
retry_strategy: Strategy | None = None
) -> None
Initialize the class instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The location of the microgrid API server in the form of a URL.
The following format is expected:
"grpc://hostname{:
TYPE:
|
channel_defaults
|
The default options use to create the channel when not specified in the URL.
TYPE:
|
connect
|
Whether to connect to the server as soon as a client instance is
created. If
TYPE:
|
retry_strategy
|
The retry strategy to use to reconnect when the connection to the streaming method is lost. By default a linear backoff strategy is used.
TYPE:
|
Source code in frequenz/client/microgrid/_client.py
battery_data
async
¤
battery_data(
component_id: int, maxsize: int = RECEIVER_MAX_SIZE
) -> Receiver[BatteryData]
Return a channel receiver that provides a BatteryData
stream.
RAISES | DESCRIPTION |
---|---|
ValueError
|
if the given id is unknown or has a different type. |
PARAMETER | DESCRIPTION |
---|---|
component_id
|
id of the battery to get data for.
TYPE:
|
maxsize
|
Size of the receiver's buffer.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[BatteryData]
|
A channel receiver that provides realtime battery data. |
Source code in frequenz/client/microgrid/_client.py
components
async
¤
Fetch all the components present in the microgrid.
RETURNS | DESCRIPTION |
---|---|
Iterable[Component]
|
Iterator whose elements are all the components in the microgrid. |
RAISES | DESCRIPTION |
---|---|
ApiClientError
|
If the are any errors communicating with the Microgrid API, most likely a subclass of GrpcError. |
Source code in frequenz/client/microgrid/_client.py
connect ¤
connect(server_url: str | None = None) -> None
Connect to the server, possibly using a new URL.
If the client is already connected and the URL is the same as the previous URL, this method does nothing. If you want to force a reconnection, you can call disconnect() first.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server to connect to. If not provided, the previously used URL is used.
TYPE:
|
Source code in frequenz/client/base/client.py
connections
async
¤
connections(
starts: Set[int] = frozenset(),
ends: Set[int] = frozenset(),
) -> Iterable[Connection]
Fetch the connections between components in the microgrid.
PARAMETER | DESCRIPTION |
---|---|
starts
|
if set and non-empty, only include connections whose start value matches one of the provided component IDs |
ends
|
if set and non-empty, only include connections whose end value matches one of the provided component IDs |
RETURNS | DESCRIPTION |
---|---|
Iterable[Connection]
|
Microgrid connections matching the provided start and end filters. |
RAISES | DESCRIPTION |
---|---|
ApiClientError
|
If the are any errors communicating with the Microgrid API, most likely a subclass of GrpcError. |
Source code in frequenz/client/microgrid/_client.py
disconnect
async
¤
Disconnect from the server.
If the client is not connected, this method does nothing.
ev_charger_data
async
¤
ev_charger_data(
component_id: int, maxsize: int = RECEIVER_MAX_SIZE
) -> Receiver[EVChargerData]
Return a channel receiver that provides an EvChargeData
stream.
RAISES | DESCRIPTION |
---|---|
ValueError
|
if the given id is unknown or has a different type. |
PARAMETER | DESCRIPTION |
---|---|
component_id
|
id of the ev charger to get data for.
TYPE:
|
maxsize
|
Size of the receiver's buffer.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[EVChargerData]
|
A channel receiver that provides realtime ev charger data. |
Source code in frequenz/client/microgrid/_client.py
inverter_data
async
¤
inverter_data(
component_id: int, maxsize: int = RECEIVER_MAX_SIZE
) -> Receiver[InverterData]
Return a channel receiver that provides an InverterData
stream.
RAISES | DESCRIPTION |
---|---|
ValueError
|
if the given id is unknown or has a different type. |
PARAMETER | DESCRIPTION |
---|---|
component_id
|
id of the inverter to get data for.
TYPE:
|
maxsize
|
Size of the receiver's buffer.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[InverterData]
|
A channel receiver that provides realtime inverter data. |
Source code in frequenz/client/microgrid/_client.py
metadata
async
¤
metadata() -> Metadata
Fetch the microgrid metadata.
If there is an error fetching the metadata, the microgrid ID and location will be set to None.
RETURNS | DESCRIPTION |
---|---|
Metadata
|
the microgrid metadata. |
Source code in frequenz/client/microgrid/_client.py
meter_data
async
¤
Return a channel receiver that provides a MeterData
stream.
RAISES | DESCRIPTION |
---|---|
ValueError
|
if the given id is unknown or has a different type. |
PARAMETER | DESCRIPTION |
---|---|
component_id
|
id of the meter to get data for.
TYPE:
|
maxsize
|
Size of the receiver's buffer.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Receiver[MeterData]
|
A channel receiver that provides realtime meter data. |
Source code in frequenz/client/microgrid/_client.py
set_bounds
async
¤
Send SetBoundsParam
s received from a channel to the Microgrid service.
PARAMETER | DESCRIPTION |
---|---|
component_id
|
ID of the component to set bounds for.
TYPE:
|
lower
|
Lower bound to be set for the component.
TYPE:
|
upper
|
Upper bound to be set for the component.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ValueError
|
when upper bound is less than 0, or when lower bound is greater than 0. |
ApiClientError
|
If the are any errors communicating with the Microgrid API, most likely a subclass of GrpcError. |
Source code in frequenz/client/microgrid/_client.py
set_power
async
¤
Send request to the Microgrid to set power for component.
If power > 0, then component will be charged with this power. If power < 0, then component will be discharged with this power. If power == 0, then stop charging or discharging component.
PARAMETER | DESCRIPTION |
---|---|
component_id
|
id of the component to set power.
TYPE:
|
power_w
|
power to set for the component.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ApiClientError
|
If the are any errors communicating with the Microgrid API, most likely a subclass of GrpcError. |
Source code in frequenz/client/microgrid/_client.py
set_reactive_power
async
¤
Send request to the Microgrid to set reactive power for component.
Negative values are for inductive (lagging) power , and positive values are for capacitive (leading) power.
PARAMETER | DESCRIPTION |
---|---|
component_id
|
id of the component to set power.
TYPE:
|
reactive_power_var
|
reactive power to set for the component.
TYPE:
|
RAISES | DESCRIPTION |
---|---|
ApiClientError
|
If the are any errors communicating with the Microgrid API, most likely a subclass of GrpcError. |
Source code in frequenz/client/microgrid/_client.py
frequenz.client.microgrid.OperationAborted ¤
Bases: GrpcError
The operation was aborted.
Typically due to a concurrency issue or transaction abort.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.OperationCancelled ¤
Bases: GrpcError
The operation was cancelled.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.OperationNotImplemented ¤
Bases: GrpcError
The operation is not implemented or not supported/enabled in this service.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.OperationOutOfRange ¤
Bases: GrpcError
The operation was attempted past the valid range.
Unlike InvalidArgument, this error indicates a problem that may be fixed if the system state changes.
There is a fair bit of overlap with OperationPreconditionFailed, this error is just a more specific version of that error and could be the result of an operation that doesn't even take any arguments.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.OperationPreconditionFailed ¤
Bases: GrpcError
The operation was rejected because the system is not in a required state.
For example, the directory to be deleted is non-empty, an rmdir operation is applied to a non-directory, etc. The user should perform some corrective action before retrying the operation.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.OperationTimedOut ¤
Bases: GrpcError
The time limit was exceeded while waiting for the operationt o complete.
For operations that change the state of the system, this error may be returned even if the operation has completed successfully. For example, a successful response from a server could have been delayed long.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.OperationUnauthenticated ¤
Bases: GrpcError
The request does not have valid authentication credentials for the operation.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.PermissionDenied ¤
Bases: GrpcError
The caller does not have permission to execute the specified operation.
Note that when the operation is rejected due to other reasons, such as the resources being exhausted or the user not being authenticated at all, different errors should be catched instead (ResourceExhausted and OperationUnauthenticated respectively).
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.ResourceExhausted ¤
Bases: GrpcError
Some resource has been exhausted (for example per-user quota, disk space, etc.).
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.ServiceUnavailable ¤
Bases: GrpcError
The service is currently unavailable.
This is most likely a transient condition, which can be corrected by retrying with a backoff. Note that it is not always safe to retry non-idempotent operations.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.UnknownError ¤
Bases: GrpcError
There was an error that can't be described using other statuses.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |
Source code in frequenz/client/base/exception.py
frequenz.client.microgrid.UnrecognizedGrpcStatus ¤
Bases: GrpcError
The gRPC server returned an unrecognized status code.
Source code in frequenz/client/base/exception.py
Attributes¤
description
instance-attribute
¤
description: str = description
The human-readable description of the error.
is_retryable
instance-attribute
¤
Whether retrying the operation might succeed.
server_url
instance-attribute
¤
server_url = server_url
The URL of the server that returned the error.
Functions¤
__init__ ¤
__init__(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> None
Create a new instance.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error originating this exception.
TYPE:
|
Source code in frequenz/client/base/exception.py
from_grpc_error
classmethod
¤
from_grpc_error(
*,
server_url: str,
operation: str,
grpc_error: AioRpcError
) -> GrpcError
Create an instance of the appropriate subclass from a gRPC error.
PARAMETER | DESCRIPTION |
---|---|
server_url
|
The URL of the server that returned the error.
TYPE:
|
operation
|
The operation that caused the error.
TYPE:
|
grpc_error
|
The gRPC error to convert.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
GrpcError
|
An instance of GrpcError if the gRPC status is not recognized, or an appropriate subclass if it is. |