mirror of
				https://github.com/Akkudoktor-EOS/EOS.git
				synced 2025-10-30 22:36:21 +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:
		| @@ -3,7 +3,6 @@ from typing import Any, Optional | ||||
| import numpy as np | ||||
| from pydantic import Field, field_validator | ||||
|  | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from akkudoktoreos.devices.devicesabc import ( | ||||
|     DeviceBase, | ||||
|     DeviceOptimizeResult, | ||||
| @@ -11,8 +10,6 @@ from akkudoktoreos.devices.devicesabc import ( | ||||
| ) | ||||
| from akkudoktoreos.utils.utils import NumpyEncoder | ||||
|  | ||||
| logger = get_logger(__name__) | ||||
|  | ||||
|  | ||||
| def max_charging_power_field(description: Optional[str] = None) -> float: | ||||
|     if description is None: | ||||
|   | ||||
| @@ -1,15 +1,12 @@ | ||||
| from typing import Optional | ||||
|  | ||||
| from akkudoktoreos.core.coreabc import SingletonMixin | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from akkudoktoreos.devices.battery import Battery | ||||
| from akkudoktoreos.devices.devicesabc import DevicesBase | ||||
| from akkudoktoreos.devices.generic import HomeAppliance | ||||
| from akkudoktoreos.devices.inverter import Inverter | ||||
| from akkudoktoreos.devices.settings import DevicesCommonSettings | ||||
|  | ||||
| logger = get_logger(__name__) | ||||
|  | ||||
|  | ||||
| class Devices(SingletonMixin, DevicesBase): | ||||
|     def __init__(self, settings: Optional[DevicesCommonSettings] = None): | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
| from enum import Enum | ||||
| from typing import Optional, Type | ||||
|  | ||||
| from loguru import logger | ||||
| from pendulum import DateTime | ||||
| from pydantic import Field, computed_field | ||||
|  | ||||
| @@ -12,12 +13,9 @@ from akkudoktoreos.core.coreabc import ( | ||||
|     EnergyManagementSystemMixin, | ||||
|     PredictionMixin, | ||||
| ) | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from akkudoktoreos.core.pydantic import ParametersBaseModel | ||||
| from akkudoktoreos.utils.datetimeutil import to_duration | ||||
|  | ||||
| logger = get_logger(__name__) | ||||
|  | ||||
|  | ||||
| class DeviceParameters(ParametersBaseModel): | ||||
|     device_id: str = Field(description="ID of device", examples="device1") | ||||
|   | ||||
| @@ -3,11 +3,8 @@ from typing import Optional | ||||
| import numpy as np | ||||
| from pydantic import Field | ||||
|  | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from akkudoktoreos.devices.devicesabc import DeviceBase, DeviceParameters | ||||
|  | ||||
| logger = get_logger(__name__) | ||||
|  | ||||
|  | ||||
| class HomeApplianceParameters(DeviceParameters): | ||||
|     """Home Appliance Device Simulation Configuration.""" | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| from typing import List, Sequence | ||||
|  | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from loguru import logger | ||||
|  | ||||
|  | ||||
| class Heatpump: | ||||
| @@ -22,7 +22,6 @@ class Heatpump: | ||||
|     def __init__(self, max_heat_output: int, hours: int): | ||||
|         self.max_heat_output = max_heat_output | ||||
|         self.hours = hours | ||||
|         self.log = get_logger(__name__) | ||||
|  | ||||
|     def __check_outside_temperature_range__(self, temp_celsius: float) -> bool: | ||||
|         """Check if temperature is in valid range between -100 and 100 degree Celsius. | ||||
| @@ -59,7 +58,7 @@ class Heatpump: | ||||
|                 f"Outside temperature '{outside_temperature_celsius}' not in range " | ||||
|                 "(min: -100 Celsius, max: 100 Celsius)" | ||||
|             ) | ||||
|             self.log.error(err_msg) | ||||
|             logger.error(err_msg) | ||||
|             raise ValueError(err_msg) | ||||
|  | ||||
|     def calculate_heating_output(self, outside_temperature_celsius: float) -> float: | ||||
| @@ -87,7 +86,7 @@ class Heatpump: | ||||
|                 f"Outside temperature '{outside_temperature_celsius}' not in range " | ||||
|                 "(min: -100 Celsius, max: 100 Celsius)" | ||||
|             ) | ||||
|             self.log.error(err_msg) | ||||
|             logger.error(err_msg) | ||||
|             raise ValueError(err_msg) | ||||
|  | ||||
|     def calculate_heat_power(self, outside_temperature_celsius: float) -> float: | ||||
| @@ -111,7 +110,7 @@ class Heatpump: | ||||
|                 f"Outside temperature '{outside_temperature_celsius}' not in range " | ||||
|                 "(min: -100 Celsius, max: 100 Celsius)" | ||||
|             ) | ||||
|             self.log.error(err_msg) | ||||
|             logger.error(err_msg) | ||||
|             raise ValueError(err_msg) | ||||
|  | ||||
|     def simulate_24h(self, temperatures: Sequence[float]) -> List[float]: | ||||
|   | ||||
| @@ -1,13 +1,11 @@ | ||||
| from typing import Optional | ||||
|  | ||||
| from loguru import logger | ||||
| from pydantic import Field | ||||
|  | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from akkudoktoreos.devices.devicesabc import DeviceBase, DeviceParameters | ||||
| from akkudoktoreos.prediction.interpolator import get_eos_load_interpolator | ||||
|  | ||||
| logger = get_logger(__name__) | ||||
|  | ||||
|  | ||||
| class InverterParameters(DeviceParameters): | ||||
|     """Inverter Device Simulation Configuration.""" | ||||
|   | ||||
| @@ -3,13 +3,10 @@ from typing import Optional | ||||
| from pydantic import Field | ||||
|  | ||||
| from akkudoktoreos.config.configabc import SettingsBaseModel | ||||
| from akkudoktoreos.core.logging import get_logger | ||||
| from akkudoktoreos.devices.battery import BaseBatteryParameters | ||||
| from akkudoktoreos.devices.generic import HomeApplianceParameters | ||||
| from akkudoktoreos.devices.inverter import InverterParameters | ||||
|  | ||||
| logger = get_logger(__name__) | ||||
|  | ||||
|  | ||||
| class DevicesCommonSettings(SettingsBaseModel): | ||||
|     """Base configuration for devices simulation settings.""" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user