Skip to content

Commit

Permalink
Use self._last_active to find the schedule-name
Browse files Browse the repository at this point in the history
  • Loading branch information
bouwew committed Oct 19, 2023
1 parent 712dea7 commit ccc766f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions plugwise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,8 @@ async def set_schedule_state(
if new_state not in ["on", "off"]:
raise PlugwiseError("Plugwise: invalid schedule state.")
if name is None:
for device in self.gw_devices.values():
if device["location"] == loc_id and device["last_used"]:
name = device["last_used"]
if schedule_name := self._last_active[loc_id]:
name = schedule_name
else:
return

Expand Down

0 comments on commit ccc766f

Please sign in to comment.