From 61540bcb49f1077db813f9f5beba2e4a7de45bbe Mon Sep 17 00:00:00 2001 From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:35:35 +0000 Subject: [PATCH 1/2] Weather comp fixes --- apps/predbat/predheat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/predbat/predheat.py b/apps/predbat/predheat.py index 190a5f89..be8c5273 100644 --- a/apps/predbat/predheat.py +++ b/apps/predbat/predheat.py @@ -135,13 +135,13 @@ def __init__(self, base): if weather_compensation: for key, value in weather_compensation.items(): self.weather_compensation[key] = value + self.weather_compensation = self.fill_table_gaps(self.weather_compensation) self.weather_compensation_enabled = True # Fill gaps in tables self.delta_correction = self.fill_table_gaps(self.delta_correction) self.gas_efficiency = self.fill_table_gaps(self.gas_efficiency) self.heat_pump_efficiency = self.fill_table_gaps(self.heat_pump_efficiency) - self.weather_compensation = self.fill_table_gaps(self.weather_compensation) self.heat_pump_efficiency_max = max(self.heat_pump_efficiency.values()) self.log("Predheat: Delta correction {}".format(self.delta_correction)) From 33a48e91636acfdf4297af6172b1cb92a11e13a4 Mon Sep 17 00:00:00 2001 From: Trefor Southwell <48591903+springfall2008@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:37:31 +0000 Subject: [PATCH 2/2] Take 2 --- apps/predbat/predheat.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/predbat/predheat.py b/apps/predbat/predheat.py index be8c5273..c43c912b 100644 --- a/apps/predbat/predheat.py +++ b/apps/predbat/predheat.py @@ -85,6 +85,10 @@ def fill_table_gaps(self, table): last_key = min_key last_value = table[min_key] new_table = {} + + if not table: + return table + for key in range(min_key, max_key + 1): if key not in table: next_value = last_value @@ -135,13 +139,13 @@ def __init__(self, base): if weather_compensation: for key, value in weather_compensation.items(): self.weather_compensation[key] = value - self.weather_compensation = self.fill_table_gaps(self.weather_compensation) self.weather_compensation_enabled = True # Fill gaps in tables self.delta_correction = self.fill_table_gaps(self.delta_correction) self.gas_efficiency = self.fill_table_gaps(self.gas_efficiency) self.heat_pump_efficiency = self.fill_table_gaps(self.heat_pump_efficiency) + self.weather_compensation = self.fill_table_gaps(self.weather_compensation) self.heat_pump_efficiency_max = max(self.heat_pump_efficiency.values()) self.log("Predheat: Delta correction {}".format(self.delta_correction))