frequenz.api.dispatch.v1.dispatch_pb2 ¤
Generated protocol buffer code.
Attributes¤
frequenz.api.dispatch.v1.dispatch_pb2.SORT_FIELD_CREATE_TIME
module-attribute
¤
CREATE_TIME: Sort by creation time of the dispatch.
frequenz.api.dispatch.v1.dispatch_pb2.SORT_FIELD_LAST_UPDATE_TIME
module-attribute
¤
UPDATE_TIME: Sort by last update time of the dispatch.
frequenz.api.dispatch.v1.dispatch_pb2.SORT_FIELD_START_TIME
module-attribute
¤
START_TIME: Sort by start time of the dispatch.
frequenz.api.dispatch.v1.dispatch_pb2.SORT_FIELD_UNSPECIFIED
module-attribute
¤
UNSPECIFIED: Default, unspecified sort field.
frequenz.api.dispatch.v1.dispatch_pb2.SORT_ORDER_ASCENDING
module-attribute
¤
ASCENDING: Results are returned in ascending order.
frequenz.api.dispatch.v1.dispatch_pb2.SORT_ORDER_DESCENDING
module-attribute
¤
DESCENDING: Results are returned in descending order.
frequenz.api.dispatch.v1.dispatch_pb2.SORT_ORDER_UNSPECIFIED
module-attribute
¤
UNSPECIFIED: Default, unspecified sort order.
Classes¤
frequenz.api.dispatch.v1.dispatch_pb2.ComponentSelector ¤
Bases: Message
Parameter for controlling which components a dispatch applies to either a set of component IDs, or a set of component categories. Examples: - To dispatch to a set of component IDs: selector { component_ids { ids: [1, 2, 3] } } - To dispatch to a set of component categories: selector { component_categories { categories: [COMPONENT_CATEGORY_BATTERY, COMPONENT_CRYPTO_MINER] } }
frequenz.api.dispatch.v1.dispatch_pb2.CreateMicrogridDispatchRequest ¤
frequenz.api.dispatch.v1.dispatch_pb2.CreateMicrogridDispatchResponse ¤
frequenz.api.dispatch.v1.dispatch_pb2.DeleteMicrogridDispatchRequest ¤
frequenz.api.dispatch.v1.dispatch_pb2.DeleteMicrogridDispatchResponse ¤
frequenz.api.dispatch.v1.dispatch_pb2.Dispatch ¤
frequenz.api.dispatch.v1.dispatch_pb2.DispatchData ¤
Bases: Message
Represents a dispatches data, including its type, start time, duration, component selector,
Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC to its local timezone.
Attributes¤
is_active
instance-attribute
¤
The "active" status An active dispatch is eligible for processing, either immediately or at a scheduled time in the future, including recurring dispatches. If a dispatch is set to inactive, it won't be processed even if it matches all other conditions, allowing for temporary disabling of dispatches without deletion.
is_dry_run
instance-attribute
¤
The "dry run" status A dry run dispatch is executed for logging and monitoring purposes without affecting the microgrid components. This is useful, for example, in scenarios where a user may want to test dispatch behavior without actually affecting any component states. Notably, a dispatch can be both "dry run" and "active," allowing for the system to generate logs and observe behavior without making actual changes.
payload
property
¤
The dispatch payload.
Note!!! The payload field allows for flexible JSON data to be associated with this dispatch. The payload must adhere to the following constraints: - Maximum JSON nesting depth: 5 levels. - The data should not contain executable code or scripts. - Ensure all data is properly sanitized and encoded. - The total size of the payload should not exceed 50 KB.
start_time
property
¤
The dispatch start time in UTC. For reoccuring dispatches this is when the first time execution occurs. When creating a dispatch, ensure that the starting timestamp is set to the current time or any future time. Timestamps earlier than the current time are not allowed.
type
instance-attribute
¤
The dispatch type. Contains user-defined information about what "type" of dispatch this is. Downstream applications that consume the dispatch API are responsible for understanding and processing this field.
frequenz.api.dispatch.v1.dispatch_pb2.DispatchFilter ¤
Bases: Message
Parameters for filtering the dispatch list
Attributes¤
end_time_interval
property
¤
Optional filter by end time Filter dispatches based on their explicit end time.
filter
property
¤
Filter by recurrence details Examples: - To retrieve only recurring dispatches with a specific frequency: filter { recurrence { filter { freq: FREQUENCY_DAILY } } } - To retrieve recurring dispatches with a specific frequency and interval: filter { recurrence { filter { freq: FREQUENCY_HOURLY, interval: 2 } } } - To retrieve recurring dispatches that end after a specific criteria: filter { recurrence { filter { end_criteria: { count: 10 } } } } - To retrieve recurring dispatches at specific minutes of the hour: filter { recurrence { filter { byminutes: [0, 15, 30, 45] } } } - To retrieve recurring dispatches at specific hours of the day: filter { recurrence { filter { byhours: [8, 12, 16] } } } - To retrieve recurring dispatches on specific days of the week: filter { recurrence { filter { byweekdays: [WEEKDAY_MONDAY, WEEKDAY_WEDNESDAY] } } } - To retrieve recurring dispatches on specific days of the month: filter { recurrence { filter { bymonthdays: [1, 15, 30, -1] } } } - To retrieve recurring dispatches in specific months of the year: filter { recurrence { filter { bymonths: [1, 6, 12] } } }
is_active
instance-attribute
¤
Optional filter by active status. If this field is not set, dispatches of any active status will be included.
is_dry_run
instance-attribute
¤
Optional filter by dry run status. If this field is not set, dispatches of any dry run status will be included.
is_recurring
instance-attribute
¤
Filter by recurring status
True: Only recurring dispatches will be returned.
False: Only non-recurring dispatches will be returned.
Examples:
- To retrieve only recurring dispatches:
filter { recurrence { is_recurring: true } }
- To retrieve only non-recurring dispatches:
filter { recurrence { is_recurring: false } }
- To retrieve all dispatches:
filter { recurrence {} }
For advanced recurrence filtering, use the filter
field.
selectors
property
¤
Optional filter by component ID or category.
start_time_interval
property
¤
Optional filter by start time. If no interval is provided, all dispatches will be returned.
update_time_interval
property
¤
Optional filter by update time
Classes¤
RecurrenceFilter ¤
Bases: Message
Recurrence filters
The fields are left commented out for now as the exact definition and requirements for recurrence filtering are still being finalized. The frequency specifier of this recurring dispatch optional RecurrenceRule.Frequency freq = 1;
frequenz.api.dispatch.v1.dispatch_pb2.DispatchMetadata ¤
Bases: Message
Represents the metadata of a dispatch
Attributes¤
end_time
property
¤
UTC Timestamp when the dispatch will stop working. Will be calculated internally based on the given: start_time, duration and RecurenceRule None if dispatch duration time is infinite and this value can't be calculated.
modification_time
property
¤
UTC Timestamp of the last update to the order.
frequenz.api.dispatch.v1.dispatch_pb2.GetMicrogridDispatchRequest ¤
frequenz.api.dispatch.v1.dispatch_pb2.GetMicrogridDispatchResponse ¤
frequenz.api.dispatch.v1.dispatch_pb2.ListMicrogridDispatchesRequest ¤
Bases: Message
Message for listing dispatches for a given microgrid.
Allows retrieval of dispatches for a specified microgrid with optional filtering and sorting. Sorting can be specified by setting 'sort_field' and 'sort_order'. If no sorting is specified, the results will be returned by their create time in a descending order.
Attributes¤
pagination_params
property
¤
pagination_params: PaginationParams
Pagination Parameters
page_size: Amount of items to return per page. Should only be provided in the first request.
page_token: Cursor to specify which page to return. Should not be set in the first request.
Should be populated in subsequent requests by the next_page_token
found in
the pagination_info
in the response.
The tokens stays valid indefinitely.
frequenz.api.dispatch.v1.dispatch_pb2.ListMicrogridDispatchesResponse ¤
Bases: Message
A list of dispatches
Attributes¤
dispatches
property
¤
The dispatches
pagination_info
property
¤
pagination_info: PaginationInfo
Pagination Info total_items: Total amount of entries found by the list request. next_page_token: Token that can be used to request the next page. Will be unset if no further pages exist.
frequenz.api.dispatch.v1.dispatch_pb2.RecurrenceRule ¤
Bases: Message
Ruleset governing when and how a dispatch should re-occur.
Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC to its local timezone.
This definition tries to adhere closely to the iCalendar specification (RFC5545), particularly for recurrence rules. For advanced use-cases or further clarifications, refer to RFC5545.
Examples¤
Every 6 months¤
Weekends only¤
message RecurrenceRule {
Frequency freq = FREQUENCY_WEEKLY;
repeated Weekday byweekdays = [WEEKDAY_SATURDAY, WEEKDAY_SUNDAY];
}
At midnight¤
Every day at midnight.
Nightly¤
Assuming "night" means from 8 PM to 6 AM.
message RecurrenceRule {
Frequency freq = FREQUENCY_DAILY;
repeated uint32 byhours = [20, 21, 22, 23, 0, 1, 2, 3, 4, 5];
}
Attributes¤
byhours
property
¤
On which hour(s) of the day does the event occur
byminutes
property
¤
On which minute(s) of the hour does the event occur
bymonthdays
property
¤
On which day(s) of the month does the event occur. Valid values are 1 to 31 or -31 to -1.
For example, -10 represents the tenth to the last day of the month. The bymonthdays rule part MUST NOT be specified when the FREQ rule part is set to WEEKLY.
bymonths
property
¤
On which month(s) of the year does the event occur
byweekdays
property
¤
On which day(s) of the week does the event occur
end_criteria
property
¤
When this dispatch should end. A dispatch can either recur a fixed number of times, or until a given timestamp. If this field is not set, the dispatch will recur indefinitely.bool
interval
instance-attribute
¤
How often this dispatch should recur, based on the frequency Example: - Every 2 hours: freq = FREQUENCY_HOURLY interval = 2 Valid values typically range between 1 and 10_000, depending on the implementation.
Classes¤
EndCriteria ¤
Bases: Message
Controls when a recurring dispatch should end
instance-attribute
¤The number of times this dispatch should recur. If this field is set, the dispatch will recur the given number of times. Valid values are 1 to 4096.
property
¤The end time of this dispatch in UTC. If this field is set, the last recurrence event will start before this timestamp. Note that the duration of the event is not considered in this value, so the dispatch may end after the timestamp.
Frequency ¤
Bases: _Frequency
Enum representing the frequency of the recurrence
Weekday ¤
Bases: _Weekday
Enum representing the day of the week
frequenz.api.dispatch.v1.dispatch_pb2.SortField ¤
frequenz.api.dispatch.v1.dispatch_pb2.SortOptions ¤
Bases: Message
Message defining parameters for sorting list requests.
Example Usage: To retrieve dispatches sorted by creation time in descending order: sort_options: { field: CREATE_TIME, order: DESCENDING }
frequenz.api.dispatch.v1.dispatch_pb2.SortOrder ¤
frequenz.api.dispatch.v1.dispatch_pb2.StreamMicrogridDispatchesRequest ¤
Bases: Message
Subscribe to a stream of microgrid dispatch requests. This method provides real-time updates on newly or updated dispatch requests for edge-based realtime decision making.
Source code in frequenz/api/dispatch/v1/dispatch_pb2.py
frequenz.api.dispatch.v1.dispatch_pb2.StreamMicrogridDispatchesResponse ¤
Bases: Message
Response to a subscription request for a stream of microgrid dispatches. Real-time information on dispatches affecting a certain microgrid are pushed through this response.
Attributes¤
frequenz.api.dispatch.v1.dispatch_pb2.TimeIntervalFilter ¤
frequenz.api.dispatch.v1.dispatch_pb2.UpdateMicrogridDispatchRequest ¤
Bases: Message
Message to update the dispatch with the given ID, with the given attributes
Attributes¤
Classes¤
DispatchUpdate ¤
Bases: Message
Message containing the updated dispatch attributes
property
¤The start time When updating a dispatch, ensure that the starting timestamp is set to the current time or any future time. Timestamps earlier than the current time are not allowed.
Bases: Message
Message containing the updated recurrence rule attributes
property
¤On which hour(s) of the day does the event occur
property
¤On which minute(s) of the hour does the event occur
property
¤On which day(s) of the month does the event occur. Valid values are 1 to 31 or -31 to -1.
For example, -10 represents the tenth to the last day of the month. The bymonthdays rule part MUST NOT be specified when the FREQ rule part is set to WEEKLY.
property
¤On which month(s) of the year does the event occur
property
¤On which day(s) of the week does the event occur
instance-attribute
¤How often this dispatch should recur, based on the frequency