Files
EOS/src/akkudoktoreos/core/ems.py

527 lines
22 KiB
Python
Raw Normal View History

import traceback
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
from typing import Any, ClassVar, Optional
2024-10-22 10:29:57 +02:00
import numpy as np
from numpydantic import NDArray, Shape
from pendulum import DateTime
from pydantic import ConfigDict, Field, computed_field, field_validator, model_validator
from typing_extensions import Self
2024-10-03 11:05:44 +02:00
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
from akkudoktoreos.core.cache import CacheUntilUpdateStore
from akkudoktoreos.core.coreabc import ConfigMixin, PredictionMixin, SingletonMixin
from akkudoktoreos.core.logging import get_logger
from akkudoktoreos.core.pydantic import ParametersBaseModel, PydanticBaseModel
2024-12-19 14:50:19 +01:00
from akkudoktoreos.devices.battery import Battery
from akkudoktoreos.devices.generic import HomeAppliance
from akkudoktoreos.devices.inverter import Inverter
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
from akkudoktoreos.utils.datetimeutil import compare_datetimes, to_datetime
from akkudoktoreos.utils.utils import NumpyEncoder
2024-10-22 10:29:57 +02:00
logger = get_logger(__name__)
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
class EnergyManagementParameters(ParametersBaseModel):
pv_prognose_wh: list[float] = Field(
description="An array of floats representing the forecasted photovoltaic output in watts for different time intervals."
)
strompreis_euro_pro_wh: list[float] = Field(
description="An array of floats representing the electricity price in euros per watt-hour for different time intervals."
)
einspeiseverguetung_euro_pro_wh: list[float] | float = Field(
description="A float or array of floats representing the feed-in compensation in euros per watt-hour."
)
preis_euro_pro_wh_akku: float = Field(
description="A float representing the cost of battery energy per watt-hour."
)
gesamtlast: list[float] = Field(
description="An array of floats representing the total load (consumption) in watts for different time intervals."
)
@model_validator(mode="after")
def validate_list_length(self) -> Self:
pv_prognose_length = len(self.pv_prognose_wh)
if (
pv_prognose_length != len(self.strompreis_euro_pro_wh)
or pv_prognose_length != len(self.gesamtlast)
or (
isinstance(self.einspeiseverguetung_euro_pro_wh, list)
and pv_prognose_length != len(self.einspeiseverguetung_euro_pro_wh)
)
):
raise ValueError("Input lists have different lengths")
return self
class SimulationResult(ParametersBaseModel):
"""This object contains the results of the simulation and provides insights into various parameters over the entire forecast period."""
Last_Wh_pro_Stunde: list[Optional[float]] = Field(description="TBD")
EAuto_SoC_pro_Stunde: list[Optional[float]] = Field(
description="The state of charge of the EV for each hour."
)
Einnahmen_Euro_pro_Stunde: list[Optional[float]] = Field(
description="The revenue from grid feed-in or other sources in euros per hour."
)
Gesamt_Verluste: float = Field(
description="The total losses in watt-hours over the entire period."
)
Gesamtbilanz_Euro: float = Field(
description="The total balance of revenues minus costs in euros."
)
Gesamteinnahmen_Euro: float = Field(description="The total revenues in euros.")
Gesamtkosten_Euro: float = Field(description="The total costs in euros.")
Home_appliance_wh_per_hour: list[Optional[float]] = Field(
description="The energy consumption of a household appliance in watt-hours per hour."
)
Kosten_Euro_pro_Stunde: list[Optional[float]] = Field(
description="The costs in euros per hour."
)
Netzbezug_Wh_pro_Stunde: list[Optional[float]] = Field(
description="The grid energy drawn in watt-hours per hour."
)
Netzeinspeisung_Wh_pro_Stunde: list[Optional[float]] = Field(
description="The energy fed into the grid in watt-hours per hour."
)
Verluste_Pro_Stunde: list[Optional[float]] = Field(
description="The losses in watt-hours per hour."
)
akku_soc_pro_stunde: list[Optional[float]] = Field(
description="The state of charge of the battery (not the EV) in percentage per hour."
)
Electricity_price: list[Optional[float]] = Field(
description="Used Electricity Price, including predictions"
)
@field_validator(
"Last_Wh_pro_Stunde",
"Netzeinspeisung_Wh_pro_Stunde",
"akku_soc_pro_stunde",
"Netzbezug_Wh_pro_Stunde",
"Kosten_Euro_pro_Stunde",
"Einnahmen_Euro_pro_Stunde",
"EAuto_SoC_pro_Stunde",
"Verluste_Pro_Stunde",
"Home_appliance_wh_per_hour",
"Electricity_price",
mode="before",
)
def convert_numpy(cls, field: Any) -> Any:
return NumpyEncoder.convert_numpy(field)[0]
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
class EnergyManagement(SingletonMixin, ConfigMixin, PredictionMixin, PydanticBaseModel):
# Disable validation on assignment to speed up simulation runs.
model_config = ConfigDict(
validate_assignment=False,
)
# Start datetime.
_start_datetime: ClassVar[Optional[DateTime]] = None
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
# last run datetime. Used by energy management task
_last_datetime: ClassVar[Optional[DateTime]] = None
@computed_field # type: ignore[prop-decorator]
@property
def start_datetime(self) -> DateTime:
"""The starting datetime of the current or latest energy management."""
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
if EnergyManagement._start_datetime is None:
EnergyManagement.set_start_datetime()
return EnergyManagement._start_datetime
@classmethod
def set_start_datetime(cls, start_datetime: Optional[DateTime] = None) -> DateTime:
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
"""Set the start datetime for the next energy management cycle.
If no datetime is provided, the current datetime is used.
The start datetime is always rounded down to the nearest hour
(i.e., setting minutes, seconds, and microseconds to zero).
Args:
start_datetime (Optional[DateTime]): The datetime to set as the start.
If None, the current datetime is used.
Returns:
DateTime: The adjusted start datetime.
"""
if start_datetime is None:
start_datetime = to_datetime()
cls._start_datetime = start_datetime.set(minute=0, second=0, microsecond=0)
return cls._start_datetime
# -------------------------
# TODO: Take from prediction
# -------------------------
load_energy_array: Optional[NDArray[Shape["*"], float]] = Field(
default=None,
description="An array of floats representing the total load (consumption) in watts for different time intervals.",
)
pv_prediction_wh: Optional[NDArray[Shape["*"], float]] = Field(
default=None,
description="An array of floats representing the forecasted photovoltaic output in watts for different time intervals.",
)
elect_price_hourly: Optional[NDArray[Shape["*"], float]] = Field(
default=None,
description="An array of floats representing the electricity price in euros per watt-hour for different time intervals.",
)
elect_revenue_per_hour_arr: Optional[NDArray[Shape["*"], float]] = Field(
default=None,
description="An array of floats representing the feed-in compensation in euros per watt-hour.",
)
# -------------------------
# TODO: Move to devices
# -------------------------
battery: Optional[Battery] = Field(default=None, description="TBD.")
ev: Optional[Battery] = Field(default=None, description="TBD.")
home_appliance: Optional[HomeAppliance] = Field(default=None, description="TBD.")
inverter: Optional[Inverter] = Field(default=None, description="TBD.")
# -------------------------
# TODO: Move to devices
# -------------------------
ac_charge_hours: Optional[NDArray[Shape["*"], float]] = Field(default=None, description="TBD")
dc_charge_hours: Optional[NDArray[Shape["*"], float]] = Field(default=None, description="TBD")
ev_charge_hours: Optional[NDArray[Shape["*"], float]] = Field(default=None, description="TBD")
def __init__(self, *args: Any, **kwargs: Any) -> None:
if hasattr(self, "_initialized"):
return
super().__init__(*args, **kwargs)
def set_parameters(
2024-10-03 11:05:44 +02:00
self,
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
parameters: EnergyManagementParameters,
ev: Optional[Battery] = None,
home_appliance: Optional[HomeAppliance] = None,
inverter: Optional[Inverter] = None,
) -> None:
self.load_energy_array = np.array(parameters.gesamtlast, float)
self.pv_prediction_wh = np.array(parameters.pv_prognose_wh, float)
self.elect_price_hourly = np.array(parameters.strompreis_euro_pro_wh, float)
self.elect_revenue_per_hour_arr = (
parameters.einspeiseverguetung_euro_pro_wh
if isinstance(parameters.einspeiseverguetung_euro_pro_wh, list)
else np.full(
len(self.load_energy_array), parameters.einspeiseverguetung_euro_pro_wh, float
)
)
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
if inverter:
self.battery = inverter.battery
else:
self.battery = None
self.ev = ev
self.home_appliance = home_appliance
self.inverter = inverter
self.ac_charge_hours = np.full(self.config.prediction.hours, 0.0)
self.dc_charge_hours = np.full(self.config.prediction.hours, 1.0)
self.ev_charge_hours = np.full(self.config.prediction.hours, 0.0)
2024-10-03 11:05:44 +02:00
def set_akku_discharge_hours(self, ds: np.ndarray) -> None:
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
if self.battery:
self.battery.set_discharge_per_hour(ds)
2024-10-03 11:05:44 +02:00
def set_akku_ac_charge_hours(self, ds: np.ndarray) -> None:
self.ac_charge_hours = ds
2024-10-22 10:29:57 +02:00
def set_akku_dc_charge_hours(self, ds: np.ndarray) -> None:
self.dc_charge_hours = ds
def set_ev_charge_hours(self, ds: np.ndarray) -> None:
self.ev_charge_hours = ds
def set_home_appliance_start(self, ds: int, global_start_hour: int = 0) -> None:
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
if self.home_appliance:
self.home_appliance.set_starting_time(ds, global_start_hour=global_start_hour)
2024-10-03 11:05:44 +02:00
def reset(self) -> None:
if self.ev:
self.ev.reset()
if self.battery:
self.battery.reset()
def run(
self,
start_hour: Optional[int] = None,
force_enable: Optional[bool] = False,
force_update: Optional[bool] = False,
) -> None:
"""Run energy management.
Sets `start_datetime` to current hour, updates the configuration and the prediction, and
starts simulation at current hour.
Args:
start_hour (int, optional): Hour to take as start time for the energy management. Defaults
to now.
force_enable (bool, optional): If True, forces to update even if disabled. This
is mostly relevant to prediction providers.
force_update (bool, optional): If True, forces to update the data even if still cached.
"""
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
# Throw away any cached results of the last run.
CacheUntilUpdateStore().clear()
self.set_start_hour(start_hour=start_hour)
# Check for run definitions
if self.start_datetime is None:
error_msg = "Start datetime unknown."
logger.error(error_msg)
raise ValueError(error_msg)
if self.config.prediction.hours is None:
error_msg = "Prediction hours unknown."
logger.error(error_msg)
raise ValueError(error_msg)
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
if self.config.optimization.hours is None:
error_msg = "Optimization hours unknown."
logger.error(error_msg)
raise ValueError(error_msg)
self.prediction.update_data(force_enable=force_enable, force_update=force_update)
# TODO: Create optimisation problem that calls into devices.update_data() for simulations.
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
def manage_energy(self) -> None:
"""Repeating task for managing energy.
This task should be executed by the server regularly (e.g., every 10 seconds)
to ensure proper energy management. Configuration changes to the energy management interval
will only take effect if this task is executed.
- Initializes and runs the energy management for the first time if it has never been run
before.
- If the energy management interval is not configured or invalid (NaN), the task will not
trigger any repeated energy management runs.
- Compares the current time with the last run time and runs the energy management if the
interval has elapsed.
- Logs any exceptions that occur during the initialization or execution of the energy
management.
Note: The task maintains the interval even if some intervals are missed.
"""
current_datetime = to_datetime()
if EnergyManagement._last_datetime is None:
# Never run before
try:
# Remember energy run datetime.
EnergyManagement._last_datetime = current_datetime
# Try to run a first energy management. May fail due to config incomplete.
self.run()
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
except Exception as e:
trace = "".join(traceback.TracebackException.from_exception(e).format())
message = f"EOS init: {e}\n{trace}"
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
logger.error(message)
return
if self.config.ems.interval is None or self.config.ems.interval == float("nan"):
# No Repetition
return
if (
compare_datetimes(current_datetime, self._last_datetime).time_diff
< self.config.ems.interval
):
# Wait for next run
return
try:
self.run()
except Exception as e:
trace = "".join(traceback.TracebackException.from_exception(e).format())
message = f"EOS run: {e}\n{trace}"
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
logger.error(message)
# Remember the energy management run - keep on interval even if we missed some intervals
while (
compare_datetimes(current_datetime, EnergyManagement._last_datetime).time_diff
>= self.config.ems.interval
):
EnergyManagement._last_datetime.add(seconds=self.config.ems.interval)
def set_start_hour(self, start_hour: Optional[int] = None) -> None:
"""Sets start datetime to given hour.
Args:
start_hour (int, optional): Hour to take as start time for the energy management. Defaults
to now.
"""
if start_hour is None:
self.set_start_datetime()
else:
start_datetime = to_datetime().set(hour=start_hour, minute=0, second=0, microsecond=0)
self.set_start_datetime(start_datetime)
def simulate_start_now(self) -> dict[str, Any]:
start_hour = to_datetime().now().hour
return self.simulate(start_hour)
def simulate(self, start_hour: int) -> dict[str, Any]:
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
"""Simulate energy usage and costs for the given start hour.
akku_soc_pro_stunde begin of the hour, initial hour state!
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
last_wh_pro_stunde integral of last hour (end state)
"""
# Check for simulation integrity
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
required_attrs = [
"load_energy_array",
"pv_prediction_wh",
"elect_price_hourly",
"ev_charge_hours",
"ac_charge_hours",
"dc_charge_hours",
"elect_revenue_per_hour_arr",
]
missing_data = [
attr.replace("_", " ").title() for attr in required_attrs if getattr(self, attr) is None
]
2024-12-29 19:37:26 +01:00
if missing_data:
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
logger.error("Mandatory data missing - %s", ", ".join(missing_data))
raise ValueError(f"Mandatory data missing: {', '.join(missing_data)}")
# Pre-fetch data
load_energy_array = np.array(self.load_energy_array)
pv_prediction_wh = np.array(self.pv_prediction_wh)
elect_price_hourly = np.array(self.elect_price_hourly)
ev_charge_hours = np.array(self.ev_charge_hours)
ac_charge_hours = np.array(self.ac_charge_hours)
dc_charge_hours = np.array(self.dc_charge_hours)
elect_revenue_per_hour_arr = np.array(self.elect_revenue_per_hour_arr)
# Fetch objects
battery = self.battery
assert battery # to please mypy
ev = self.ev
home_appliance = self.home_appliance
inverter = self.inverter
if not (len(load_energy_array) == len(pv_prediction_wh) == len(elect_price_hourly)):
error_msg = f"Array sizes do not match: Load Curve = {len(load_energy_array)}, PV Forecast = {len(pv_prediction_wh)}, Electricity Price = {len(elect_price_hourly)}"
logger.error(error_msg)
raise ValueError(error_msg)
end_hour = len(load_energy_array)
total_hours = end_hour - start_hour
2024-09-30 10:32:04 +02:00
# Pre-allocate arrays for the results, optimized for speed
loads_energy_per_hour = np.full((total_hours), np.nan)
feedin_energy_per_hour = np.full((total_hours), np.nan)
consumption_energy_per_hour = np.full((total_hours), np.nan)
costs_per_hour = np.full((total_hours), np.nan)
revenue_per_hour = np.full((total_hours), np.nan)
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
soc_per_hour = np.full((total_hours), np.nan)
soc_ev_per_hour = np.full((total_hours), np.nan)
losses_wh_per_hour = np.full((total_hours), np.nan)
home_appliance_wh_per_hour = np.full((total_hours), np.nan)
electricity_price_per_hour = np.full((total_hours), np.nan)
# Set initial state
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
soc_per_hour[0] = battery.current_soc_percentage()
if ev:
soc_ev_per_hour[0] = ev.current_soc_percentage()
2024-10-22 10:29:57 +02:00
for hour in range(start_hour, end_hour):
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
hour_idx = hour - start_hour
# save begin states
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
soc_per_hour[hour_idx] = battery.current_soc_percentage()
if ev:
soc_ev_per_hour[hour_idx] = ev.current_soc_percentage()
2024-10-22 10:29:57 +02:00
# Accumulate loads and PV generation
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
consumption = load_energy_array[hour]
losses_wh_per_hour[hour_idx] = 0.0
# Home appliances
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
if home_appliance:
ha_load = home_appliance.get_load_for_hour(hour)
consumption += ha_load
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
home_appliance_wh_per_hour[hour_idx] = ha_load
2024-09-30 10:32:04 +02:00
# E-Auto handling
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
if ev and ev_charge_hours[hour] > 0:
loaded_energy_ev, verluste_eauto = ev.charge_energy(
None, hour, relative_power=ev_charge_hours[hour]
)
consumption += loaded_energy_ev
losses_wh_per_hour[hour_idx] += verluste_eauto
# Process inverter logic
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
energy_feedin_grid_actual = energy_consumption_grid_actual = losses = eigenverbrauch = (
0.0
)
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
hour_ac_charge = ac_charge_hours[hour]
hour_dc_charge = dc_charge_hours[hour]
hourly_electricity_price = elect_price_hourly[hour]
hourly_energy_revenue = elect_revenue_per_hour_arr[hour]
battery.set_charge_allowed_for_hour(hour_dc_charge, hour)
if inverter:
energy_produced = pv_prediction_wh[hour]
(
energy_feedin_grid_actual,
energy_consumption_grid_actual,
losses,
eigenverbrauch,
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
) = inverter.process_energy(energy_produced, consumption, hour)
2024-10-20 18:18:06 +02:00
# AC PV Battery Charge
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
if hour_ac_charge > 0.0:
battery.set_charge_allowed_for_hour(1, hour)
battery_charged_energy_actual, battery_losses_actual = battery.charge_energy(
None, hour, relative_power=hour_ac_charge
2024-10-22 10:29:57 +02:00
)
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
total_battery_energy = battery_charged_energy_actual + battery_losses_actual
consumption += total_battery_energy
energy_consumption_grid_actual += total_battery_energy
losses_wh_per_hour[hour_idx] += battery_losses_actual
# Update hourly arrays
feedin_energy_per_hour[hour_idx] = energy_feedin_grid_actual
consumption_energy_per_hour[hour_idx] = energy_consumption_grid_actual
losses_wh_per_hour[hour_idx] += losses
loads_energy_per_hour[hour_idx] = consumption
electricity_price_per_hour[hour_idx] = hourly_electricity_price
# Financial calculations
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
costs_per_hour[hour_idx] = energy_consumption_grid_actual * hourly_electricity_price
revenue_per_hour[hour_idx] = energy_feedin_grid_actual * hourly_energy_revenue
2024-09-30 10:32:04 +02:00
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
total_cost = np.nansum(costs_per_hour)
total_losses = np.nansum(losses_wh_per_hour)
total_revenue = np.nansum(revenue_per_hour)
# Prepare output dictionary
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
return {
"Last_Wh_pro_Stunde": loads_energy_per_hour,
"Netzeinspeisung_Wh_pro_Stunde": feedin_energy_per_hour,
"Netzbezug_Wh_pro_Stunde": consumption_energy_per_hour,
"Kosten_Euro_pro_Stunde": costs_per_hour,
"akku_soc_pro_stunde": soc_per_hour,
"Einnahmen_Euro_pro_Stunde": revenue_per_hour,
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
"Gesamtbilanz_Euro": total_cost - total_revenue,
"EAuto_SoC_pro_Stunde": soc_ev_per_hour,
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
"Gesamteinnahmen_Euro": total_revenue,
"Gesamtkosten_Euro": total_cost,
"Verluste_Pro_Stunde": losses_wh_per_hour,
Data prefetch ems for feature (#420) * Pre-fetch data * maintanance and extend tests * comment clean up * nansum usage (to be save) * Feature/config nested (#421) * Nested config, devices registry * All config now nested. - Use default config from model field default values. If providers should be enabled by default, non-empty default config file could be provided again. - Environment variable support with EOS_ prefix and __ between levels, e.g. EOS_SERVER__EOS_SERVER_PORT=8503 where all values are case insensitive. For more information see: https://docs.pydantic.dev/latest/concepts/pydantic_settings/#parsing-environment-variable-values - Use devices as registry for configured devices. DeviceBase as base class with for now just initializion support (in the future expand to operations during optimization). - Strip down ConfigEOS to the only configuration instance. Reload from file or reset to defaults is possible. * Fix multi-initialization of derived SingletonMixin classes. * Documentation: Support nested config * Add examples to pydantic models. * EOSdash: Support nested types * Rename settings variables (remove prefixes) * Fix API endpoint * Fix EOSdash startup (docker) * Docker: Copy the same directory structure (src/) to support the lifespan startup of EOSdash. Use EOS_SERVER_EOSDASH_SESSKEY environment variable to provide EOSdash with session key. * PR review * PVForecast: planes as nested config (list) * Update manual documentation for nested config. * Add config_file_path, config_folder_path back to general (ConfigCommonSettings). Overwrite in docs generation. * Config: Move lat/long/timezone from prediction to general * Docs: Add global example documentation. * merge_models: Use deecopy to not change input data. * EOSdash: Sort config by name * Review comments * Feature/config nested dependabot req. (#415) * Bump numpydantic from 1.6.4 to 1.6.7 (#413) Bumps [numpydantic](https://github.com/p2p-ld/numpydantic) from 1.6.4 to 1.6.7. - [Release notes](https://github.com/p2p-ld/numpydantic/releases) - [Changelog](https://github.com/p2p-ld/numpydantic/blob/main/docs/changelog.md) - [Commits](https://github.com/p2p-ld/numpydantic/compare/v1.6.4...v1.6.7) --- updated-dependencies: - dependency-name: numpydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump timezonefinder from 6.5.7 to 6.5.8 (#414) Bumps [timezonefinder](https://github.com/jannikmi/timezonefinder) from 6.5.7 to 6.5.8. - [Release notes](https://github.com/jannikmi/timezonefinder/releases) - [Changelog](https://github.com/jannikmi/timezonefinder/blob/master/CHANGELOG.rst) - [Commits](https://github.com/jannikmi/timezonefinder/compare/6.5.7...6.5.8) --- updated-dependencies: - dependency-name: timezonefinder dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump pydantic from 2.10.5 to 2.10.6 (#412) Bumps [pydantic](https://github.com/pydantic/pydantic) from 2.10.5 to 2.10.6. - [Release notes](https://github.com/pydantic/pydantic/releases) - [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md) - [Commits](https://github.com/pydantic/pydantic/compare/v2.10.5...v2.10.6) --- updated-dependencies: - dependency-name: pydantic dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bump fastapi[standard] from 0.115.6 to 0.115.7 (#411) Bumps [fastapi[standard]](https://github.com/fastapi/fastapi) from 0.115.6 to 0.115.7. - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.115.6...0.115.7) --- updated-dependencies: - dependency-name: fastapi[standard] dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Readme: Add hint for interfering ports on Synology Closes #408 (#419) * Pics or it didn't happen (#402) * inverter added * png creation * save svg into cache folder * mypy * comment --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * inverter, prediction.hours * self.config.general.data_cache_path --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: Dominique Lasserre <lasserre.d@gmail.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-01-26 19:12:14 +01:00
"Gesamt_Verluste": total_losses,
"Home_appliance_wh_per_hour": home_appliance_wh_per_hour,
"Electricity_price": electricity_price_per_hour,
2024-02-18 14:32:27 +01:00
}
# Initialize the Energy Management System, it is a singleton.
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
ems = EnergyManagement()
Improve caching. (#431) * Move the caching module to core. Add an in memory cache that for caching function and method results during an energy management run (optimization run). Two decorators are provided for methods and functions. * Improve the file cache store by load and save functions. Make EOS load the cache file store on startup and save it on shutdown. Add a cyclic task that cleans the cache file store from outdated cache files. * Improve startup of EOSdash by EOS Make EOS starting EOSdash adhere to path configuration given in EOS. The whole environment from EOS is now passed to EOSdash. Should also prevent test errors due to unwanted/ wrong config file creation. Both servers now provide a health endpoint that can be used to detect whether the server is running. This is also used for testing now. * Improve startup of EOS EOS now has got an energy management task that runs shortly after startup. It tries to execute energy management runs with predictions newly fetched or initialized from cached data on first run. * Improve shutdown of EOS EOS has now a shutdown task that shuts EOS down gracefully with some time delay to allow REST API requests for shutdwon or restart to be fully serviced. * Improve EMS Add energy management task for repeated energy management controlled by startup delay and interval configuration parameters. Translate EnergieManagementSystem to english EnergyManagement. * Add administration endpoints - endpoints to control caching from REST API. - endpoints to control server restart (will not work on Windows) and shutdown from REST API * Improve doc generation Use "\n" linenend convention also on Windows when generating doc files. Replace Windows specific 127.0.0.1 address by standard 0.0.0.0. * Improve test support (to be able to test caching) - Add system test option to pytest for running tests with "real" resources - Add new test fixture to start server for test class and test function - Make kill signal adapt to Windows/ Linux - Use consistently "\n" for lineends when writing text files in doc test - Fix test_logging under Windows - Fix conftest config_default_dirs test fixture under Windows From @Lasall * Improve Windows support - Use 127.0.0.1 as default config host (model defaults) and addionally redirect 0.0.0.0 to localhost on Windows (because default config file still has 0.0.0.0). - Update install/startup instructions as package installation is required atm. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2025-02-12 21:35:51 +01:00
def get_ems() -> EnergyManagement:
"""Gets the EOS Energy Management System."""
return ems