mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-10-11 20:06:18 +00:00
fix: logging, prediction update, multiple bugs (#584)
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled
Some checks failed
docker-build / platform-excludes (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Run Pytest on Pull Request / test (push) Has been cancelled
docker-build / build (push) Has been cancelled
docker-build / merge (push) Has been cancelled
Close stale pull requests/issues / Find Stale issues and PRs (push) Has been cancelled
* Fix logging configuration issues that made logging stop operation. Switch to Loguru logging (from Python logging). Enable console and file logging with different log levels. Add logging documentation. * Fix logging configuration and EOS configuration out of sync. Added tracking support for nested value updates of Pydantic models. This used to update the logging configuration when the EOS configurationm for logging is changed. Should keep logging config and EOS config in sync as long as all changes to the EOS logging configuration are done by set_nested_value(), which is the case for the REST API. * Fix energy management task looping endlessly after the second update when trying to update the last_update datetime. * Fix get_nested_value() to correctly take values from the dicts in a Pydantic model instance. * Fix usage of model classes instead of model instances in nested value access when evaluation the value type that is associated to each key. * Fix illegal json format in prediction documentation for PVForecastAkkudoktor provider. * Fix documentation qirks and add EOS Connect to integrations. * Support deprecated fields in configuration in documentation generation and EOSdash. * Enhance EOSdash demo to show BrightSky humidity data (that is often missing) * Update documentation reference to German EOS installation videos. Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
This commit is contained in:
@@ -13,16 +13,17 @@ from matplotlib.backends.backend_pdf import PdfPages
|
||||
|
||||
from akkudoktoreos.core.coreabc import ConfigMixin
|
||||
from akkudoktoreos.core.ems import EnergyManagement
|
||||
from akkudoktoreos.core.logging import get_logger
|
||||
from akkudoktoreos.optimization.genetic import OptimizationParameters
|
||||
from akkudoktoreos.utils.datetimeutil import to_datetime
|
||||
|
||||
logger = get_logger(__name__)
|
||||
matplotlib.use(
|
||||
"Agg"
|
||||
) # non-interactive backend that can only write to files, backend needed to stay in main thread.
|
||||
|
||||
|
||||
debug_visualize: bool = False
|
||||
|
||||
|
||||
class VisualizationReport(ConfigMixin):
|
||||
def __init__(
|
||||
self,
|
||||
@@ -440,6 +441,8 @@ def prepare_visualize(
|
||||
filename: str = "visualization_results.pdf",
|
||||
start_hour: int = 0,
|
||||
) -> None:
|
||||
global debug_visualize
|
||||
|
||||
report = VisualizationReport(filename)
|
||||
next_full_hour_date = EnergyManagement.set_start_datetime()
|
||||
# Group 1:
|
||||
@@ -642,7 +645,7 @@ def prepare_visualize(
|
||||
|
||||
if filtered_balance.size > 0 or filtered_losses.size > 0:
|
||||
report.finalize_group()
|
||||
if logger.level == "DEBUG" or results["fixed_seed"]:
|
||||
if debug_visualize or results["fixed_seed"]:
|
||||
report.create_line_chart(
|
||||
0,
|
||||
[
|
||||
@@ -667,6 +670,8 @@ def prepare_visualize(
|
||||
|
||||
def generate_example_report(filename: str = "example_report.pdf") -> None:
|
||||
"""Generate example visualization report."""
|
||||
global debug_visualize
|
||||
|
||||
report = VisualizationReport(filename, "test")
|
||||
x_hours = 0 # Define x-axis start values (e.g., hours)
|
||||
|
||||
@@ -738,9 +743,9 @@ def generate_example_report(filename: str = "example_report.pdf") -> None:
|
||||
|
||||
report.finalize_group() # Finalize the third group of charts
|
||||
|
||||
logger.setLevel("DEBUG") # set level for example report
|
||||
debug_visualize = True # set level for example report
|
||||
|
||||
if logger.level == "DEBUG":
|
||||
if debug_visualize:
|
||||
report.create_line_chart(
|
||||
x_hours,
|
||||
[np.array([0.2, 0.25, 0.3, 0.35])],
|
||||
|
Reference in New Issue
Block a user