Skip to content

Commit 192c044

Browse files
authored
Merge pull request #140 from MTrab:Remove-forecast-data-for-past-days
Skip forecast data if day is in the past
2 parents 5601e74 + 7116338 commit 192c044

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

custom_components/energidataservice/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ async def update_carnot(self, dt=None): # type: ignore pylint: disable=unused-a
288288
self._carnot_apikey, self._carnot_user
289289
)
290290

291+
self.predictions[:] = (
292+
value
293+
for value in self.predictions
294+
if value.hour.day >= (datetime.now() + timedelta(days=1)).day
295+
)
296+
291297
if self._tomorrow_valid:
292298
# Remove tomorrows predictions, as we have the actual values
293299
self.predictions[:] = (

0 commit comments

Comments
 (0)