Skip to content

Commit af7aa35

Browse files
committed
Make sure to update self._home_location at every update
1 parent 28f53d7 commit af7aa35

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

plugwise/helper.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,12 @@ def _get_locations(self) -> None:
229229
for location in locations:
230230
loc.loc_id = location.attrib["id"]
231231
loc.name = location.find("name").text
232+
if loc.name == "Home":
233+
self._home_loc_id = loc.loc_id
234+
self._home_location = self._domain_objects.find(
235+
f"./location[@id='{loc.loc_id}']"
236+
)
237+
232238
self._new_locations.append(loc.loc_id)
233239
if (
234240
loc.loc_id in self._existing_locations
@@ -242,13 +248,6 @@ def _get_locations(self) -> None:
242248
"primary_prio": 0,
243249
"secondary": [],
244250
}
245-
if loc.name != "Home":
246-
continue
247-
248-
self._home_loc_id = loc.loc_id
249-
self._home_location = self._domain_objects.find(
250-
f"./location[@id='{loc.loc_id}']"
251-
)
252251

253252
removed = list(set(self._existing_locations) - set(self._new_locations))
254253
if self._existing_locations and removed:

0 commit comments

Comments
 (0)