@@ -570,15 +570,21 @@ def _all_appliances(self) -> None:
570570 # Legacy P1 has no more devices
571571 return
572572
573+ hc_count = 0
573574 for appliance in self ._appliances .findall ("./appliance" ):
574575 appl = Munch ()
575576 appl .pwclass = appliance .find ("type" ).text
576- # Skip thermostats that have this key, should be an orphaned device (Core #81712)
577+ # Count amount of heater_central's
578+ if appl .pwclass == "heater_central" :
579+ hc_count += 1
580+ # Mark heater_central and thermostat that have this key,
581+ # could be an orphaned device (Core #81712, #104433)
582+ appl .has_actuators = True
577583 if (
578- appl .pwclass == " thermostat"
584+ appl .pwclass in [ "heater_central" , " thermostat"]
579585 and appliance .find ("actuator_functionalities/" ) is None
580586 ):
581- continue
587+ appl . has_actuators = False
582588
583589 appl .location = None
584590 if (appl_loc := appliance .find ("location" )) is not None :
@@ -622,6 +628,7 @@ def _all_appliances(self) -> None:
622628 for key , value in {
623629 "firmware" : appl .firmware ,
624630 "hardware" : appl .hardware ,
631+ "has_actuators" : appl .has_actuators ,
625632 "location" : appl .location ,
626633 "mac_address" : appl .mac ,
627634 "model" : appl .model ,
@@ -634,6 +641,27 @@ def _all_appliances(self) -> None:
634641 self .gw_devices [appl .dev_id ][appl_key ] = value
635642 self ._count += 1
636643
644+ # Remove thermostat with empty actuator_functionalities (Core #81712), remove heater_central
645+ # with empty actuator_functionalities but only when there are more than one (Core #104433).
646+ for dev_id , device in dict (self .gw_devices ).items ():
647+ if device ["dev_class" ] == "thermostat" :
648+ if not self .gw_devices [dev_id ]["has_actuators" ]:
649+ self ._count -= len (self .gw_devices [dev_id ])
650+ self .gw_devices .pop (dev_id )
651+ else :
652+ self .gw_devices [dev_id ].pop ("has_actuators" )
653+ self ._count -= 1
654+ elif device ["dev_class" ] == "heater_central" and hc_count > 1 :
655+ if not self .gw_devices [dev_id ]["has_actuators" ]:
656+ self ._count -= len (self .gw_devices [dev_id ])
657+ self .gw_devices .pop (dev_id )
658+ else :
659+ self .gw_devices [dev_id ].pop ("has_actuators" )
660+ self ._count -= 1
661+ elif "has_actuators" in self .gw_devices [dev_id ]:
662+ self .gw_devices [dev_id ].pop ("has_actuators" )
663+ self ._count -= 1
664+
637665 # For non-legacy P1 collect the connected SmartMeter info
638666 if self .smile_type == "power" :
639667 self ._p1_smartmeter_info_finder (appl )
0 commit comments