@@ -244,10 +244,12 @@ def _device_data_climate(
244244 if self .check_reg_mode ("off" ):
245245 device_data ["mode" ] = "off"
246246
247+ if NONE in avail_schedules :
248+ return device_data
249+
247250 device_data = self ._get_schedule_states_with_off (
248251 loc_id , avail_schedules , sel_schedule , device_data
249252 )
250-
251253 return device_data
252254
253255 def check_reg_mode (self , mode : str ) -> bool :
@@ -265,22 +267,20 @@ def _get_schedule_states_with_off(
265267 Also, replace NONE by OFF when none of the schedules are active,
266268 only for non-legacy thermostats.
267269 """
268- if NONE not in schedules :
269- loc_schedule_states : dict [str , str ] = {}
270- for schedule in schedules :
271- loc_schedule_states [schedule ] = "off"
272- if schedule == selected and data ["mode" ] == "auto" :
273- loc_schedule_states [schedule ] = "on"
274-
275- self ._schedule_old_states [location ] = loc_schedule_states
276-
277- all_off = True
278- if not self ._smile_legacy :
279- for state in self ._schedule_old_states [location ].values ():
280- if state == "on" :
281- all_off = False
282- if all_off :
283- data ["select_schedule" ] = OFF
270+ loc_schedule_states : dict [str , str ] = {}
271+ for schedule in schedules :
272+ loc_schedule_states [schedule ] = "off"
273+ if schedule == selected and data ["mode" ] == "auto" :
274+ loc_schedule_states [schedule ] = "on"
275+ self ._schedule_old_states [location ] = loc_schedule_states
276+
277+ all_off = True
278+ if not self ._smile_legacy :
279+ for state in self ._schedule_old_states [location ].values ():
280+ if state == "on" :
281+ all_off = False
282+ if all_off :
283+ data ["select_schedule" ] = OFF
284284
285285 return data
286286
0 commit comments