Skip to content

Commit

Permalink
Make future_span a float with a 1 hour floor
Browse files Browse the repository at this point in the history
  • Loading branch information
rgc99 committed Aug 15, 2024
1 parent 1e8904c commit 9a88bb2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ class IURunQueue(list[IURun]):

# pylint: disable=too-many-public-methods

DAYS_SPAN: int = 3
DAYS_SPAN: float = 3.0

def __init__(self) -> None:
super().__init__()
Expand Down Expand Up @@ -1664,7 +1664,7 @@ def load(self, config: OrderedDict, all_zones: OrderedDict):
fsd = IURunQueue.DAYS_SPAN
if all_zones is not None:
fsd = all_zones.get(CONF_FUTURE_SPAN, fsd)
fsd = max(config.get(CONF_FUTURE_SPAN, fsd), 1)
fsd = max(config.get(CONF_FUTURE_SPAN, fsd), 1 / 24)
self._future_span = wash_td(timedelta(days=fsd))
return self

Expand Down
4 changes: 2 additions & 2 deletions custom_components/irrigation_unlimited/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def _parse_dd_mmm(value: str) -> date | None:
vol.Optional(CONF_ALLOW_MANUAL): cv.boolean,
vol.Optional(CONF_MINIMUM): cv.positive_time_period,
vol.Optional(CONF_MAXIMUM): cv.positive_time_period,
vol.Optional(CONF_FUTURE_SPAN): cv.positive_int,
vol.Optional(CONF_FUTURE_SPAN): cv.positive_float,
vol.Optional(CONF_SHOW): vol.All(SHOW_SCHEMA),
vol.Optional(CONF_CHECK_BACK): vol.All(CHECK_BACK_SCHEMA),
vol.Optional(CONF_VOLUME): vol.All(VOLUME_SCHEMA),
Expand All @@ -251,7 +251,7 @@ def _parse_dd_mmm(value: str) -> date | None:
vol.Optional(CONF_SHOW): vol.All(SHOW_SCHEMA),
vol.Optional(CONF_MINIMUM): cv.positive_time_period,
vol.Optional(CONF_MAXIMUM): cv.positive_time_period,
vol.Optional(CONF_FUTURE_SPAN): cv.positive_int,
vol.Optional(CONF_FUTURE_SPAN): cv.positive_float,
vol.Optional(CONF_ALLOW_MANUAL): cv.boolean,
vol.Optional(CONF_CHECK_BACK): vol.All(CHECK_BACK_SCHEMA),
vol.Optional(CONF_VOLUME): vol.All(VOLUME_SCHEMA),
Expand Down

0 comments on commit 9a88bb2

Please sign in to comment.