@@ -456,7 +456,11 @@ def _appliance_info_finder(self, appliance: etree, appl: Munch) -> Munch:
456456 if not self ._opentherm_device and not self ._on_off_device :
457457 return None
458458
459- self ._heater_id = appliance .attrib ["id" ]
459+ # Find the valid heater_central
460+ if (result := self ._check_heater_central ()) is None :
461+ return None
462+ self ._heater_id = result
463+
460464 # Info for On-Off device
461465 if self ._on_off_device :
462466 appl .name = "OnOff"
@@ -498,6 +502,33 @@ def _appliance_info_finder(self, appliance: etree, appl: Munch) -> Munch:
498502
499503 return appl
500504
505+ def _check_heater_central (self ) -> str | None :
506+ """Helper finding the valid heater_central.
507+
508+ Solution for Core Issue #104433,
509+ for a system that has two heater_central appliances.
510+ """
511+ locator = "./appliance[type='heater_central']"
512+ hc_count = 0
513+ hc_list : list [dict [str , str ]] = []
514+ for heater_central in self ._appliances .findall (locator ):
515+ hc_count += 1
516+ hc_id : str = heater_central .attrib ["id" ]
517+ has_actuators : bool = (
518+ heater_central .find ("actuator_functionalities/" ) is not None
519+ )
520+ hc_list .append ({hc_id : has_actuators })
521+
522+ heater_central_id = list (hc_list [0 ].keys ())[0 ]
523+ if hc_count > 1 :
524+ for item in hc_list :
525+ for key , value in item .items ():
526+ heater_central_id = None
527+ if value :
528+ heater_central_id = key
529+
530+ return heater_central_id
531+
501532 def _p1_smartmeter_info_finder (self , appl : Munch ) -> None :
502533 """Collect P1 DSMR Smartmeter info."""
503534 loc_id = next (iter (self ._loc_data .keys ()))
0 commit comments