Skip to content

Commit

Permalink
Merge pull request #288 from EdLeckert/fix-support-run_seconds-index-…
Browse files Browse the repository at this point in the history
…as-int-or-str

fix: allow run_seconds to use int or str as keys
  • Loading branch information
vinteo authored May 31, 2024
2 parents 6ae5238 + 8be5db4 commit 0150cf1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions custom_components/opensprinkler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,9 +316,12 @@ async def run(self, run_seconds=None, continue_running_stations=None):
if isinstance(run_seconds, dict):
run_seconds_list = []
for _, station in self._controller.stations.items():
seconds = run_seconds.get(
station.index, run_seconds.get(str(station.index))
)
run_seconds_list.append(
run_seconds.get(str(station.index))
if run_seconds.get(str(station.index)) is not None
seconds
if seconds is not None
else (0 if continue_running_stations else station.seconds_remaining)
)
await self._controller.run_once_program(run_seconds_list)
Expand Down

0 comments on commit 0150cf1

Please sign in to comment.