File tree Expand file tree Collapse file tree 2 files changed +11
-12
lines changed
Expand file tree Collapse file tree 2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -208,12 +208,10 @@ def _get_groups(self) -> None:
208208 if group_id is None :
209209 continue # pragma: no cover
210210
211- self ._new_groups .append (group_id )
212- if (
213- (members := self ._collect_members (group ))
214- and group_id in self ._existing_groups
215- and self .gw_entities [group_id ]["name" ] == group_name
216- ):
211+ members = self ._collect_members (group )
212+ if group_id not in self ._existing_groups and members :
213+ self ._new_groups .append (group_id )
214+ elif self .gw_entities [group_id ]["name" ] == group_name
217215 continue
218216
219217 group_type = group .find ("type" ).text
@@ -226,9 +224,6 @@ def _get_groups(self) -> None:
226224 "vendor" : "Plugwise" ,
227225 }
228226 self ._count += 5
229- elif group_id in self ._existing_groups :
230- # Group existed but now has no valid members -> remove
231- self ._new_groups .remove (group_id )
232227
233228 removed = list (set (self ._existing_groups ) - set (self ._new_groups ))
234229 if self ._existing_groups and removed :
Original file line number Diff line number Diff line change @@ -157,15 +157,19 @@ def _get_appliances(self) -> bool:
157157
158158 extend_plug_device_class (appl , appliance )
159159
160- self ._new_appliances .append (appl .entity_id )
161- if appl .entity_id in self ._existing_appliances and (
160+ if appl .entity_id not in self ._existing_appliances :
161+ self ._new_appliances .append (appl .entity_id )
162+ elif (
162163 appl .pwclass in ("gateway" , "heater_central" )
163164 or self .gw_entities [appl .entity_id ]["name" ] == appl .name
164165 ):
165166 continue
166167
167168 # Collect appliance info, skip orphaned/removed devices
168- if not (appl := self ._appliance_info_finder (appl , appliance )):
169+ if not (
170+ appl := self ._appliance_info_finder (appl , appliance )
171+ and appl .entity_id in self ._new_appliances
172+ ):
169173 self ._new_appliances .pop ()
170174 continue
171175
You can’t perform that action at this time.
0 commit comments