Skip to content

Commit 0a7c5a2

Browse files
committed
Add comment, move break to optimize
1 parent 3af64a5 commit 0a7c5a2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

plugwise/smile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,12 +405,13 @@ async def set_switch_state(
405405
locator = f'appliance[@id="{appl_id}"]/{switch.actuator}/{switch.func_type}'
406406
found: list[etree] = self._domain_objects.findall(locator)
407407
for item in found:
408+
# multiple types of e.g. toggle_functionality present
408409
if (sw_type := item.find("type")) is not None:
409410
if sw_type.text == switch.act_type:
410411
switch_id = item.attrib["id"]
411-
else:
412+
break
413+
else: # actuators with a single item like relay_functionality
412414
switch_id = item.attrib["id"]
413-
break
414415

415416
data = f"""
416417
<{switch.func_type}>

0 commit comments

Comments
 (0)