@@ -267,7 +267,7 @@ def _all_appliances(self) -> None:
267267 self ._all_locations ()
268268
269269 for appliance in self ._domain_objects .findall ("./appliance" ):
270- appl = Munch ()
270+ appl : Munch | None = Munch ()
271271 appl .pwclass = appliance .find ("type" ).text
272272 # Don't collect data for the OpenThermGateway appliance
273273 if appl .pwclass == "open_therm_gateway" :
@@ -310,14 +310,7 @@ def _all_appliances(self) -> None:
310310 appl .vendor_name = None
311311
312312 # Collect appliance info
313- appl = self ._appliance_info_finder (appl , appliance )
314-
315- # Skip orphaned heater_central (Core Issue #104433)
316- if appl .pwclass == "heater_central" and appl .dev_id != self ._heater_id :
317- continue
318-
319- # Skip orphaned/removed plug-type
320- if "_plug" in appl .pwclass and appl .zigbee_mac is None :
313+ if (appl := self ._appliance_info_finder (appl , appliance )) is None :
321314 continue
322315
323316 # P1: for gateway and smartmeter switch device_id - part 1
@@ -381,7 +374,7 @@ def _p1_smartmeter_info_finder(self, appl: Munch) -> None:
381374
382375 self ._create_gw_devices (appl )
383376
384- def _appliance_info_finder (self , appl : Munch , appliance : etree ) -> Munch :
377+ def _appliance_info_finder (self , appl : Munch , appliance : etree ) -> Munch | None :
385378 """Collect info for all appliances found."""
386379 match appl .pwclass :
387380 case "gateway" :
@@ -394,6 +387,9 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
394387 # Collect heater_central device info
395388 self ._appl_heater_central_info (appl , appliance , False ) # False means non-legacy device
396389 self ._appl_dhw_mode_info (appl , appliance )
390+ # Skip orphaned heater_central (Core Issue #104433)
391+ if appl .dev_id != self ._heater_id :
392+ return None
397393 return appl
398394 case _ as s if s .endswith ("_plug" ):
399395 # Collect info from plug-types (Plug, Aqara Smart Plug)
@@ -402,7 +398,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
402398 module_data = self ._get_module_data (appliance , locator , mod_type )
403399 # A plug without module-data is orphaned/ no present
404400 if not module_data ["contents" ]:
405- return appl
401+ return None
406402
407403 appl .firmware = module_data ["firmware_version" ]
408404 appl .hardware = module_data ["hardware_version" ]
0 commit comments