Skip to content

Commit 97910ae

Browse files
committed
Combine _location_specials() with _all_locations()
1 parent 051b50c commit 97910ae

File tree

1 file changed

+7
-18
lines changed

1 file changed

+7
-18
lines changed

plugwise/helper.py

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -395,27 +395,12 @@ def __init__(self) -> None:
395395
self.smile_version: tuple[str, semver.version.Version]
396396
self.smile_zigbee_mac_address: str | None = None
397397

398-
def _locations_specials(self, loc: Munch, location: str) -> Munch:
399-
"""Helper-function for _all_locations().
400-
401-
Correct location info in special cases.
402-
"""
403-
if loc.name == "Home":
404-
self._home_location = loc.loc_id
405-
406-
# Replace location-name for P1 legacy, can contain privacy-related info
407-
if self._smile_legacy and self.smile_type == "power":
408-
loc.name = "Home"
409-
self._home_location = loc.loc_id
410-
411-
return loc
412-
413398
def _all_locations(self) -> None:
414399
"""Collect all locations."""
415400
loc = Munch()
416401

417-
# Legacy Anna without outdoor_temp and Stretches have no locations, create one containing all appliances
418402
locations = self._locations.findall("./location")
403+
# Legacy Anna without outdoor_temp and Stretches have no locations, create fake location-data
419404
if not locations and self._smile_legacy:
420405
self._home_location = FAKE_LOC
421406
self._loc_data[FAKE_LOC] = {"name": "Home"}
@@ -433,8 +418,12 @@ def _all_locations(self) -> None:
433418
):
434419
continue
435420

436-
# Specials
437-
loc = self._locations_specials(loc, location)
421+
if loc.name == "Home":
422+
self._home_location = loc.loc_id
423+
# Replace location-name for P1 legacy, can contain privacy-related info
424+
if self._smile_legacy and self.smile_type == "power":
425+
loc.name = "Home"
426+
self._home_location = loc.loc_id
438427

439428
self._loc_data[loc.loc_id] = {"name": loc.name}
440429

0 commit comments

Comments
 (0)