Skip to content

Commit fb5de5f

Browse files
committed
Further _schedules() cleanup
1 parent 4ea4b63 commit fb5de5f

File tree

1 file changed

+5
-19
lines changed

1 file changed

+5
-19
lines changed

plugwise/helper.py

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,25 +1084,11 @@ def _schedules(self, location: str) -> tuple[list[str], str, str | None]:
10841084
schedules: list[str] = []
10851085
for rule_id, loc_id in rule_ids.items():
10861086
name = self._domain_objects.find(f'./rule[@id="{rule_id}"]/name').text
1087-
schedule = False
1088-
locator = f'./rule[@id="{rule_id}"]/directives'
1089-
directives = self._domain_objects.find(locator)
1090-
count = 0
1091-
for _ in directives:
1092-
count += 1
1093-
1094-
if count > 1:
1095-
schedule = True
1096-
else:
1097-
# Schedule with less than 2 items
1098-
LOGGER.debug("Invalid schedule, only one entry, ignoring.")
1099-
1100-
if schedule:
1101-
available.append(name)
1102-
if location == loc_id:
1103-
selected = name
1104-
self._last_active[location] = selected
1105-
schedules.append(name)
1087+
available.append(name)
1088+
if location == loc_id:
1089+
selected = name
1090+
self._last_active[location] = selected
1091+
schedules.append(name)
11061092

11071093
if schedules:
11081094
available.remove(NONE)

0 commit comments

Comments
 (0)