test_elecpriceakkudoktor bugfix (#360)

* test_elecpriceakkudoktor bugfix

* remove print

* warning
This commit is contained in:
Normann 2025-01-10 23:20:55 +01:00 committed by GitHub
parent 34d8e88771
commit b43bf105aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -187,6 +187,13 @@ class ElecPriceAkkudoktor(ElecPriceProvider):
self.config.prediction_hours self.config.prediction_hours
- ((highest_orig_datetime - self.start_datetime).total_seconds() // 3600) - ((highest_orig_datetime - self.start_datetime).total_seconds() // 3600)
) )
if needed_prediction_hours <= 0:
logger.warning(
f"No prediction needed. needed_prediction_hours={needed_prediction_hours}, prediction_hours={self.config.prediction_hours},highest_orig_datetime {highest_orig_datetime}, start_datetime {self.start_datetime}"
) # this might keep data longer than self.start_datetime + self.config.prediction_hours in the records
return
if amount_datasets > 800: # we do the full ets with seasons of 1 week if amount_datasets > 800: # we do the full ets with seasons of 1 week
prediction = self._predict_ets( prediction = self._predict_ets(
history, seasonal_periods=168, prediction_hours=needed_prediction_hours history, seasonal_periods=168, prediction_hours=needed_prediction_hours