Skip to content

Commit f2ea99e

Browse files
committed
Handle group name change, improve guarding
1 parent 4e48f14 commit f2ea99e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

plugwise/common.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,23 @@ def _get_groups(self) -> None:
205205
for group in self._domain_objects.findall("./group"):
206206
members: list[str] = []
207207
group_id = group.get("id")
208+
group_name = group.find("name").text
209+
if group_id is None:
210+
continue # pragma: no cover
211+
208212
self._new_groups.append(group_id)
209-
if group_id in self._existing_groups:
213+
if (
214+
group_id in self._existing_groups
215+
and self.gw_entities[group_id]["name"] == group_name
216+
):
210217
continue
211-
group_name = group.find("name").text
218+
212219
group_type = group.find("type").text
213220
group_appliances = group.findall("appliances/appliance")
214221
for item in group_appliances:
215222
self._add_member(item, members)
216223

217-
if group_type in GROUP_TYPES and members and group_id:
224+
if group_type in GROUP_TYPES and members:
218225
self.gw_entities[group_id] = {
219226
"dev_class": group_type,
220227
"model": "Group",

0 commit comments

Comments
 (0)