mirror of
https://github.com/Akkudoktor-EOS/EOS.git
synced 2025-10-11 20:06:18 +00:00
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.
This commit is contained in:
@@ -34,7 +34,7 @@ class VisualizationReport(ConfigMixin):
|
||||
self.pdf_pages = PdfPages(filename, metadata={}) # Initialize PdfPages without metadata
|
||||
self.version = version # overwrite version as test for constant output of pdf for test
|
||||
self.current_time = to_datetime(
|
||||
as_string="YYYY-MM-DD HH:mm:ss", in_timezone=self.config.timezone
|
||||
as_string="YYYY-MM-DD HH:mm:ss", in_timezone=self.config.prediction.timezone
|
||||
)
|
||||
|
||||
def add_chart_to_group(self, chart_func: Callable[[], None]) -> None:
|
||||
@@ -51,7 +51,7 @@ class VisualizationReport(ConfigMixin):
|
||||
|
||||
def _initialize_pdf(self) -> None:
|
||||
"""Create the output directory if it doesn't exist and initialize the PDF."""
|
||||
output_dir = self.config.data_output_path
|
||||
output_dir = self.config.general.data_output_path
|
||||
|
||||
# If self.filename is already a valid path, use it; otherwise, combine it with output_dir
|
||||
if os.path.isabs(self.filename):
|
||||
@@ -173,7 +173,7 @@ class VisualizationReport(ConfigMixin):
|
||||
plt.grid(True)
|
||||
|
||||
# Add vertical line for the current date if within the axis range
|
||||
current_time = pendulum.now(self.config.timezone)
|
||||
current_time = pendulum.now(self.config.prediction.timezone)
|
||||
if timestamps[0].subtract(hours=2) <= current_time <= timestamps[-1]:
|
||||
plt.axvline(current_time, color="r", linestyle="--", label="Now")
|
||||
plt.text(current_time, plt.ylim()[1], "Now", color="r", ha="center", va="bottom")
|
||||
@@ -419,7 +419,7 @@ def prepare_visualize(
|
||||
start_hour: Optional[int] = 0,
|
||||
) -> None:
|
||||
report = VisualizationReport(filename)
|
||||
next_full_hour_date = pendulum.now(report.config.timezone).start_of("hour").add(hours=1)
|
||||
next_full_hour_date = pendulum.now(report.config.prediction.timezone).start_of("hour").add(hours=1)
|
||||
# Group 1:
|
||||
report.create_line_chart_date(
|
||||
next_full_hour_date, # start_date
|
||||
|
Reference in New Issue
Block a user