Extend TimeWindow with two new optional fields: - month (1–12): restricts the window to a start date in the given calendar month. Useful for seasonal schedules. - end_time: explicit exclusive end-of-window clock time. The effective end is the later of end_time and start_time + duration. Primary motivation is DST handling — a wall-clock end_time stays correct across DST transitions, whereas a fixed duration does not. Rework window semantics so date, weekday, and month restrictions apply to the window's start date, not to every timestamp covered by the window. This makes overnight windows (e.g. Friday 22:00 → Saturday 06:00) behave intuitively under calendar constraints; contains() now checks both today's and yesterday's candidate start. duration becomes optional (default 0). All start/end/duration computations route through _window_start_end and a new _matches_start_date helper, so contains, earliest_start_time, latest_start_time, and available_duration stay consistent. Dashboard: add end_time and month inputs to the time-window editor, render the collapsed window summary as icons + pills. Docs, OpenAPI spec, and generated config docs are regenerated for the new fields. Tests cover month filtering, end_time boundary cases (incl. midnight and overnight), and start-date semantics for overnight windows. Bump version to support automatic updates in Home Assistant. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
13 KiB
Electricity Price Prediction Configuration
:::{table} elecfee :widths: 10 20 10 5 5 30 :align: left
| Name | Environment Variable | Type | Read-Only | Default | Description |
|---|---|---|---|---|---|
| elecfeefixed | EOS_ELECFEE__ELECFEEFIXED |
ElecFeeFixedCommonSettings |
rw |
required |
Fixed electricity fees provider settings. |
| elecfeeimport | EOS_ELECFEE__ELECFEEIMPORT |
ElecFeeImportCommonSettings |
rw |
required |
Electricity fees import provider settings. |
| provider | EOS_ELECFEE__PROVIDER |
Optional[str] |
rw |
None |
Electricity fee provider id of provider to be used. |
| providers | list[str] |
ro |
N/A |
Available electricity fee provider ids. | |
| ::: |
Example Input
{
"elecfee": {
"provider": "ElecFeeFixed",
"elecfeefixed": {
"consumption_amt_kwh": {
"windows": []
},
"consumption_percent_amt": {
"windows": []
},
"feedin_amt_kwh": {
"windows": []
},
"feedin_percent_amt": {
"windows": []
}
},
"elecfeeimport": {
"import_file_path": null,
"import_json": null
}
}
}
Example Output
{
"elecfee": {
"provider": "ElecFeeFixed",
"elecfeefixed": {
"consumption_amt_kwh": {
"windows": []
},
"consumption_percent_amt": {
"windows": []
},
"feedin_amt_kwh": {
"windows": []
},
"feedin_percent_amt": {
"windows": []
}
},
"elecfeeimport": {
"import_file_path": null,
"import_json": null
},
"providers": [
"ElecFeeFixed",
"ElecFeeImport"
]
}
}
Common settings for elecfee data import from file or JSON String
:::{table} elecfee::elecfeeimport :widths: 10 10 5 5 30 :align: left
| Name | Type | Read-Only | Default | Description |
|---|---|---|---|---|
| import_file_path | Union[str, pathlib.Path, NoneType] |
rw |
None |
Path to the file to import elecfee data from. |
| import_json | Optional[str] |
rw |
None |
JSON string, dictionary of electricity fee forecast value lists. |
| ::: |
Example Input/Output
{
"elecfee": {
"elecfeeimport": {
"import_file_path": null,
"import_json": "{\"elecfee_consumption_amt_wh\": [0.0003384, 0.0003318, 0.0003284]}"
}
}
}
Value applicable during a specific time window
This model extends TimeWindow by associating a value with the defined time interval.
:::{table} elecfee::elecfeefixed::consumption_amt_kwh::windows::list :widths: 10 10 5 5 30 :align: left
| Name | Type | Read-Only | Default | Description |
|---|---|---|---|---|
| date | Optional[pydantic_extra_types.pendulum_dt.Date] |
rw |
None |
Optional specific calendar date on which the time window must start. For overnight windows, this restriction applies to the start date, not the date of each datetime tested by contains(). |
| day_of_week | Union[int, str, NoneType] |
rw |
None |
Optional day of the week on which the time window must start. Can be specified as integer (0=Monday to 6=Sunday) or localized weekday name. For overnight windows, the restriction applies to the start date. |
| duration | Duration |
rw |
0 microseconds |
Duration of the time window starting from start_time. |
| end_time | Optional[akkudoktoreos.utils.datetimeutil.Time] |
rw |
None |
Optional exclusive end time of the window. The effective end is the later of end_time and start_time + duration. End time is dalight saving time change save, whereas duration is always fixed. If None (the default), the window ends at start_time + duration. |
| locale | Optional[str] |
rw |
None |
Locale used to parse weekday names in day_of_week when given as string. If not set, Pendulum's default locale is used. Examples: 'en', 'de', 'fr', etc. |
| month | Optional[int] |
rw |
None |
Optional calendar month restriction (1=January to 12=December). The window's start date must fall in this month, including for overnight windows that extend into the following month. |
| start_time | Time |
rw |
required |
Naive start time of the time window (time of day, no timezone). Interpreted in the timezone of the datetime passed to contains() or earliest_start_time(). |
| value | Optional[float] |
rw |
None |
Value applicable during this time window. |
| ::: |
Example Input/Output
{
"elecfee": {
"elecfeefixed": {
"consumption_amt_kwh": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "2 hours",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 0.288
}
]
}
}
}
}
Sequence of value time windows
This model specializes TimeWindowSequence to ensure that all
contained windows are instances of ValueTimeWindow.
It provides the full set of sequence operations (containment checks,
availability, start time calculations) for value windows.
:::{table} elecfee::elecfeefixed::consumption_amt_kwh :widths: 10 10 5 5 30 :align: left
| Name | Type | Read-Only | Default | Description |
|---|---|---|---|---|
| windows | list[akkudoktoreos.config.configabc.ValueTimeWindow] |
rw |
required |
Ordered list of value time windows. Each window defines a time interval and an associated value. |
| ::: |
Example Input/Output
{
"elecfee": {
"elecfeefixed": {
"consumption_amt_kwh": {
"windows": []
}
}
}
}
Common settings for fixed electricity fees
This model defines a fixed electricity fee schedule using a sequence of time windows. Each window specifies a time interval and the electricity fee applicable during that interval.
:::{table} elecfee::elecfeefixed :widths: 10 10 5 5 30 :align: left
| Name | Type | Read-Only | Default | Description |
|---|---|---|---|---|
| consumption_amt_kwh | ValueTimeWindowSequence |
rw |
required |
Sequence of time windows defining the total fixed per-kWh electricty fee charged for consumed energy, accumulating all applicable fixed per-kWh charges (e.g. network charge, metering fee, concession fee) into a single amount [amount/kWh]. If not provided, no fixed per-kWh consumption fee is applied. |
| consumption_percent_amt | ValueTimeWindowSequence |
rw |
required |
Sequence of time windows defining the total fixed electricity surcharge applied as a percentage of the monetary amount already charged for consumed energy, accumulating all applicable percentage-based surcharges (e.g. VAT, electricity tax) into a single percentage [%]. This is a percentage of the fee amount, not a per-kWh rate. If not provided, no percentage-based consumption surcharge is applied. |
| feedin_amt_kwh | ValueTimeWindowSequence |
rw |
required |
Sequence of time windows defining the total deduction from feed-in energy per Wh [amount/Wh]. This is the accumulation of all fixed per-Wh charges deducted from feed-in energy - such as metering fees or grid-operator handling charges - into a single amount. Applied after the percentage-based deduction, i.e. it reduces the price by a flat amount per Wh rather than by a share of the raw price. If not provided, no fixed per-kWh feed-in fee is applied. |
| feedin_percent_amt | ValueTimeWindowSequence |
rw |
required |
Sequence of time windows defining the total percentage deducted from the raw feed-in price (spot price) [%]. This is the accumulation of all percentage-based deductions payable on the feed-in tariff - such as a marketing or balancing fee retained by the aggregator - into a single percentage. It is applied as raw_price * (100 - percent) / 100, i.e. it scales down the raw price rather than adding a surcharge to it. If not provided, no percentage-based feed-in deduction is applied. |
| ::: |
Example Input/Output
{
"elecfee": {
"elecfeefixed": {
"consumption_amt_kwh": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "8 hours",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 0.00288
},
{
"start_time": "08:00:00.000000",
"duration": "16 hours",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 0.0034
}
]
},
"consumption_percent_amt": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "1 day",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 19.0
}
]
},
"feedin_amt_kwh": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "8 hours",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 0.00288
},
{
"start_time": "08:00:00.000000",
"duration": "16 hours",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 0.0034
}
]
},
"feedin_percent_amt": {
"windows": [
{
"start_time": "00:00:00.000000",
"duration": "1 day",
"end_time": null,
"day_of_week": null,
"date": null,
"month": null,
"locale": null,
"value": 19.0
}
]
}
}
}
}