Skip to content

Commit 08863b8

Browse files
committed
Revert removals and adapt
1 parent a4853af commit 08863b8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugwise/smile.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ async def set_regulation_mode(self, mode: str) -> None:
307307
async def set_schedule_state(
308308
self,
309309
loc_id: str,
310-
new_state: str,
311-
name: str,
310+
new_state: str | None,
311+
name: str | None,
312312
) -> None:
313313
"""Activate/deactivate the Schedule, with the given name, on the relevant Thermostat.
314314
@@ -323,6 +323,12 @@ async def set_schedule_state(
323323
if name == OFF:
324324
new_state = STATE_OFF
325325

326+
# Handle no schedule-name / schedule-off requested: find the active schedule
327+
if name is None or name == OFF:
328+
_, name = self._schedules(loc_id)
329+
if name == OFF: # no active schedule found, nothing to do
330+
return
331+
326332
schedule_rule = self._rule_ids_by_name(name, loc_id)
327333
# Raise an error when the schedule name does not exist
328334
if not schedule_rule or schedule_rule is None:

0 commit comments

Comments
 (0)