Skip to content

Commit

Permalink
Move check after _appliance_info_finder()
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwew committed Nov 30, 2023
1 parent ae6041b commit bc4f47d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions plugwise/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,16 +603,12 @@ def _all_appliances(self) -> None:
for appliance in self._appliances.findall("./appliance"):
appl = Munch()
appl.pwclass = appliance.find("type").text
appl.dev_id = appliance.attrib["id"]
# Skip thermostats that have this key, should be an orphaned device (Core #81712)
if (
appl.pwclass == "thermostat"
and appliance.find("actuator_functionalities/") is None
):
continue
# Skip orphaned heater_central (Core Issue #104433)
if appl.pwclass == "heater_central" and appl.dev_id != self._heater_id:
continue

appl.location = None
if (appl_loc := appliance.find("location")) is not None:
Expand All @@ -624,6 +620,7 @@ def _all_appliances(self) -> None:
) or appl.pwclass not in THERMOSTAT_CLASSES:
appl.location = self._home_location

appl.dev_id = appliance.attrib["id"]
appl.name = appliance.find("name").text
appl.model = appl.pwclass.replace("_", " ").title()
appl.firmware = None
Expand All @@ -637,6 +634,10 @@ def _all_appliances(self) -> None:
if not (appl := self._appliance_info_finder(appliance, appl)):
continue

# Skip orphaned heater_central (Core Issue #104433)
if appl.pwclass == "heater_central" and appl.dev_id != self._heater_id:
continue

# P1: for gateway and smartmeter switch device_id - part 1
# This is done to avoid breakage in HA Core
if appl.pwclass == "gateway" and self.smile_type == "power":
Expand Down

0 comments on commit bc4f47d

Please sign in to comment.