From b5e545a959c83890c124dc60fe75b09872bc2b96 Mon Sep 17 00:00:00 2001 From: Guy Badman <61918526+badguy99@users.noreply.github.com> Date: Fri, 24 Apr 2020 16:12:42 +0100 Subject: [PATCH] Add check to make sure hot water status is active before checking if it is heating water --- custom_components/badnest/water_heater.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/custom_components/badnest/water_heater.py b/custom_components/badnest/water_heater.py index 7332341..1fa0e6c 100644 --- a/custom_components/badnest/water_heater.py +++ b/custom_components/badnest/water_heater.py @@ -190,9 +190,12 @@ class NestWaterHeater(WaterHeaterDevice): # heating_active - true if hot water is currently being heated. # So it is either on via schedule or boost and currently firing # (demand on) the boiler - if self.device.device_data[self.device_id]['hot_water_actively_heating']: - boiler_firing = self.device.device_data[self.device_id]['hot_water_actively_heating'] - data[ATTR_HEATING_ACTIVE] = boiler_firing + if self.device.device_data[self.device_id]['hot_water_status']: + if self.device.device_data[self.device_id]['hot_water_actively_heating']: + boiler_firing = self.device.device_data[self.device_id]['hot_water_actively_heating'] + data[ATTR_HEATING_ACTIVE] = boiler_firing + else: + data[ATTR_HEATING_ACTIVE] = False else: data[ATTR_HEATING_ACTIVE] = False