@@ -164,6 +164,7 @@ def schedules_temps(
164164 # Roll over to next Monday when now is before first schedule point
165165 if today == 0 and before_first :
166166 today = 7
167+
167168 if in_between (today , day_0 , day_1 , now , time_0 , time_1 ):
168169 return schedule_list [i ][2 ]
169170
@@ -383,21 +384,6 @@ def __init__(self) -> None:
383384 self .smile_version : tuple [str , VersionInfo ]
384385 self .smile_zigbee_mac_address : str | None = None
385386
386- def _locations_legacy (self ) -> None :
387- """Helper-function for _all_locations().
388-
389- Create locations for legacy devices.
390- """
391- appliances = set ()
392- self ._home_location = FAKE_LOC
393-
394- # Add Anna appliances
395- for appliance in self ._appliances .findall ("./appliance" ):
396- appliances .add (appliance .attrib ["id" ])
397-
398- if self .smile_type in ("stretch" , "thermostat" ):
399- self ._loc_data [FAKE_LOC ] = {"name" : "Home" }
400-
401387 def _locations_specials (self , loc : Munch , location : str ) -> Munch :
402388 """Helper-function for _all_locations().
403389
@@ -420,7 +406,8 @@ def _all_locations(self) -> None:
420406 # Legacy Anna without outdoor_temp and Stretches have no locations, create one containing all appliances
421407 locations = self ._locations .findall ("./location" )
422408 if not locations and self ._smile_legacy :
423- self ._locations_legacy ()
409+ self ._home_location = FAKE_LOC
410+ self ._loc_data [FAKE_LOC ] = {"name" : "Home" }
424411 return
425412
426413 for location in locations :
@@ -699,7 +686,7 @@ def _all_appliances(self) -> None:
699686 appl .location = None
700687 if (appl_loc := appliance .find ("location" )) is not None :
701688 appl .location = appl_loc .attrib ["id" ]
702- # Provide a home_location for legacy_anna, don't assign the _home_location
689+ # Provide a location for legacy_anna, also don't assign the _home_location
703690 # to thermostat-devices without a location, they are not active
704691 elif (
705692 self ._smile_legacy and self .smile_type == "thermostat"
@@ -763,8 +750,6 @@ def _match_locations(self) -> dict[str, ThermoLoc]:
763750 Match appliances with locations.
764751 """
765752 matched_locations : dict [str , ThermoLoc ] = {}
766-
767- self ._all_appliances ()
768753 for location_id , location_details in self ._loc_data .items ():
769754 for appliance_details in self ._appl_data .values ():
770755 if appliance_details ["location" ] == location_id :
@@ -1086,8 +1071,9 @@ def _scan_thermostats(self) -> None:
10861071 Update locations with thermostat ranking results and use
10871072 the result to update the device_class of slave thermostats.
10881073 """
1074+ self ._all_appliances ()
10891075 if self .smile_type != "thermostat" :
1090- pass
1076+ return
10911077
10921078 self ._thermo_locs = self ._match_locations ()
10931079
0 commit comments