Skip to content

Commit 98c428c

Browse files
committed
Fix depreciation-warnings
1 parent ec0be29 commit 98c428c

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

plugwise/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,12 +406,12 @@ async def _smile_detect_legacy(
406406
"""Helper-function for _smile_detect()."""
407407
return_model = model
408408
# Stretch: find the MAC of the zigbee master_controller (= Stick)
409-
if network := result.find("./module/protocols/master_controller"):
409+
if (network := result.find("./module/protocols/master_controller")) is not None:
410410
self.smile_zigbee_mac_address = network.find("mac_address").text
411411
# Find the active MAC in case there is an orphaned Stick
412412
if zb_networks := result.findall("./network"):
413413
for zb_network in zb_networks:
414-
if zb_network.find("./nodes/network_router"):
414+
if zb_network.find("./nodes/network_router") is not None:
415415
network = zb_network.find("./master_controller")
416416
self.smile_zigbee_mac_address = network.find("mac_address").text
417417

plugwise/helper.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,14 @@ def _get_module_data(
349349
model_data["hardware_version"] = module.find("hardware_version").text
350350
model_data["firmware_version"] = module.find("firmware_version").text
351351
# Adam
352-
if zb_node := module.find("./protocols/zig_bee_node"):
352+
if (zb_node := module.find("./protocols/zig_bee_node")) is not None:
353353
model_data["zigbee_mac_address"] = zb_node.find("mac_address").text
354354
model_data["reachable"] = zb_node.find("reachable").text == "true"
355355
# Stretches
356-
if router := module.find("./protocols/network_router"):
356+
if (router := module.find("./protocols/network_router")) is not None:
357357
model_data["zigbee_mac_address"] = router.find("mac_address").text
358358
# Also look for the Circle+/Stealth M+
359-
if coord := module.find("./protocols/network_coordinator"):
359+
if (coord := module.find("./protocols/network_coordinator")) is not None:
360360
model_data["zigbee_mac_address"] = coord.find("mac_address").text
361361

362362
return model_data
@@ -420,7 +420,7 @@ def _appliance_info_finder(self, appliance: etree, appl: Munch) -> Munch:
420420

421421
# Adam: look for the ZigBee MAC address of the Smile
422422
if self.smile(ADAM) and (
423-
found := self._modules.find(".//protocols/zig_bee_coordinator")
423+
(found := self._modules.find(".//protocols/zig_bee_coordinator")) is not None
424424
):
425425
appl.zigbee_mac = found.find("mac_address").text
426426

@@ -1490,7 +1490,7 @@ def _schedules(self, location: str) -> tuple[list[str], str]:
14901490
name = self._domain_objects.find(f'./rule[@id="{rule_id}"]/name').text
14911491
locator = f'./rule[@id="{rule_id}"]/directives'
14921492
# Show an empty schedule as no schedule found
1493-
if not self._domain_objects.find(locator):
1493+
if self._domain_objects.find(locator) is None:
14941494
continue # pragma: no cover
14951495

14961496
available.append(name)

0 commit comments

Comments
 (0)