@@ -102,7 +102,7 @@ def is_in_schedule_grace_period(location=None):
102102 )
103103
104104 since_switch_point = now - switch_point
105- if since_switch_point .total_seconds () < settings .HEATING_SCHEDULE_GRACE_TIME :
105+ if since_switch_point .total_seconds () < settings .PRESENCE_HEATING_SCHEDULE_GRACE_TIME :
106106 return True
107107
108108 return False
@@ -165,7 +165,7 @@ def _get_current_zone_switch_point_from_schedule(zone):
165165 if zone_switch_point_temperature == previous_zone_switch_point_temperature :
166166 continue
167167
168- if zone_switch_point_temperature <= settings . HEATING_SCHEDULE_OFF_TEMP :
168+ if _is_considered_off ( zone_switch_point_temperature ) :
169169 continue
170170
171171 if zone_switch_point_datetime > now or zone_switch_point_datetime < last_switch_point_datetime :
@@ -190,6 +190,10 @@ def get_zones(location):
190190 yield zone
191191
192192
193+ def _is_considered_off (temperature ):
194+ return temperature <= settings .EVOHOME_OFF_TEMP_THRESHOLD
195+
196+
193197def _is_override_enabled (control_system ):
194198 current_mode = ThermostatStatuses .get_by_mode (control_system .systemModeStatus ["mode" ])
195199 if current_mode in [ThermostatStatuses .away , ThermostatStatuses .day_off , ThermostatStatuses .off ]:
@@ -204,33 +208,32 @@ def _is_override_enabled(control_system):
204208
205209
206210def _is_normal_heating_needed (location ):
207- eco_temperature = settings .HEATING_ECO_TEMPERATURE
208- if eco_temperature is None :
211+ if not settings .AUTO_ECO_ENABLED :
209212 return True
210213
214+ outside_temp_threshold = settings .AUTO_ECO_OUTSIDE_TEMP_THRESHOLD
215+ inside_temp_diff = settings .AUTO_ECO_INSIDE_TEMP_DIFF
211216 highest_set_point_temp = _get_highest_set_point_temp (location )
212217
213218 # all zones are off?
214- if highest_set_point_temp <= settings . HEATING_SCHEDULE_OFF_TEMP :
219+ if _is_considered_off ( highest_set_point_temp ) :
215220 return True
216221
217- outside_current_temperature = weather .get_temperature_info ()
222+ # can we fetch a valid temperature?
223+ outside_current_temp = weather .get_temperature ()
224+ if outside_current_temp <= - 99 :
225+ return True
218226
219227 logger .debug (
220228 "current outside temperature: %s degrees celsius" ,
221- outside_current_temperature ,
229+ outside_current_temp ,
222230 )
223231
224232 # are we below the eco mode threshold?
225- if outside_current_temperature < eco_temperature :
233+ if outside_current_temp < outside_temp_threshold :
226234 return True
227235
228- try :
229- temperature_offset = float (settings .HEATING_ECO_TEMPERATURE_OFFSET or 0.0 )
230- except (TypeError , ValueError ):
231- temperature_offset = 0.0
232-
233- return outside_current_temperature + temperature_offset < highest_set_point_temp
236+ return outside_current_temp + inside_temp_diff < highest_set_point_temp
234237
235238
236239def _get_highest_set_point_temp (location = None ):
0 commit comments