Skip to content

Commit 90ed590

Browse files
committed
Add comment, move break to optimize
1 parent 36c7c0f commit 90ed590

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
@@ -401,12 +401,13 @@ async def set_switch_state(
401401
locator = f'appliance[@id="{appl_id}"]/{switch.actuator}/{switch.func_type}'
402402
found: list[etree] = self._domain_objects.findall(locator)
403403
for item in found:
404+
# multiple types of e.g. toggle_functionality present
404405
if (sw_type := item.find("type")) is not None:
405406
if sw_type.text == switch.act_type:
406407
switch_id = item.attrib["id"]
407-
else:
408+
break
409+
else: # actuators with a single item like relay_functionality
408410
switch_id = item.attrib["id"]
409-
break
410411

411412
data = (
412413
f"<{switch.func_type}>"

0 commit comments

Comments
 (0)