From c4279e7dbee2aeee676ea0ebc00fa3191b1c7426 Mon Sep 17 00:00:00 2001 From: Nathan Date: Sun, 26 Mar 2023 08:18:08 +0100 Subject: [PATCH] Timezones weren't a good idea --- custom_components/foxess_em/battery/battery_model.py | 6 +++++- custom_components/foxess_em/const.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_components/foxess_em/battery/battery_model.py b/custom_components/foxess_em/battery/battery_model.py index b6cd944..7ab000d 100755 --- a/custom_components/foxess_em/battery/battery_model.py +++ b/custom_components/foxess_em/battery/battery_model.py @@ -138,7 +138,11 @@ def _charge_totals( ): """Return charge totals for dawn/day""" # calculate start/end of the next peak period - eco_start = period.replace( + now = datetime.now().astimezone() + eco_start = now.replace( + year=period.year, + month=period.month, + day=period.day, hour=self._eco_start_time.hour, minute=self._eco_start_time.minute, second=0, diff --git a/custom_components/foxess_em/const.py b/custom_components/foxess_em/const.py index 5d0e2c8..dd2a4ee 100755 --- a/custom_components/foxess_em/const.py +++ b/custom_components/foxess_em/const.py @@ -23,7 +23,7 @@ # Configuration and options SOLCAST_API_KEY = "key" SOLCAST_SCAN_INTERVAL = "scan_interval" -# SOLCAST_URL = "https://61b90ede-0458-4ebe-b5ad-a300063ab299.mock.pstmn.io" +# SOLCAST_URL = "https://364c31d2-231a-4a41-a7ee-6b0f357fdb75.mock.pstmn.io" SOLCAST_URL = "https://api.solcast.com.au" FORECAST = "sensor.foxess_em_forecast"