Skip to content

Commit e42388a

Browse files
committed
Fix use of Much-None
1 parent 2d96dde commit e42388a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

plugwise/helper.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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 | None = Munch()
270+
appl = Munch()
271271
appl.pwclass = appliance.find("type").text
272272
# Don't collect data for the OpenThermGateway appliance
273273
if appl.pwclass == "open_therm_gateway":
@@ -309,8 +309,8 @@ def _all_appliances(self) -> None:
309309
appl.zigbee_mac = None
310310
appl.vendor_name = None
311311

312-
# Collect appliance info
313-
if (appl := self._appliance_info_finder(appl, appliance)) is None:
312+
# Collect appliance info, skip orphaned/removed devices
313+
if not (appl := self._appliance_info_finder(appl, appliance)):
314314
continue
315315

316316
# P1: for gateway and smartmeter switch device_id - part 1
@@ -374,7 +374,7 @@ def _p1_smartmeter_info_finder(self, appl: Munch) -> None:
374374

375375
self._create_gw_devices(appl)
376376

377-
def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch | None:
377+
def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch:
378378
"""Collect info for all appliances found."""
379379
match appl.pwclass:
380380
case "gateway":
@@ -389,7 +389,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch | None:
389389
self._appl_dhw_mode_info(appl, appliance)
390390
# Skip orphaned heater_central (Core Issue #104433)
391391
if appl.dev_id != self._heater_id:
392-
return None
392+
return Munch()
393393
return appl
394394
case _ as s if s.endswith("_plug"):
395395
# Collect info from plug-types (Plug, Aqara Smart Plug)
@@ -398,7 +398,7 @@ def _appliance_info_finder(self, appl: Munch, appliance: etree) -> Munch | None:
398398
module_data = self._get_module_data(appliance, locator, mod_type)
399399
# A plug without module-data is orphaned/ no present
400400
if not module_data["contents"]:
401-
return None
401+
return Munch()
402402

403403
appl.firmware = module_data["firmware_version"]
404404
appl.hardware = module_data["hardware_version"]

0 commit comments

Comments
 (0)