mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Check that time_pattern interval matcher is not zero (#142630)
Co-authored-by: Abílio Costa <abmantis@users.noreply.github.com> Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
2074c7fcee
commit
595508bf7d
@ -37,6 +37,8 @@ class TimePattern:
|
||||
|
||||
if isinstance(value, str) and value.startswith("/"):
|
||||
number = int(value[1:])
|
||||
if number == 0:
|
||||
raise vol.Invalid(f"must be a value between 1 and {self.maximum}")
|
||||
else:
|
||||
value = number = int(value)
|
||||
|
||||
|
@ -365,6 +365,7 @@ async def test_invalid_schemas() -> None:
|
||||
{"platform": "time_pattern", "minutes": "/"},
|
||||
{"platform": "time_pattern", "minutes": "*/5"},
|
||||
{"platform": "time_pattern", "minutes": "/90"},
|
||||
{"platform": "time_pattern", "hours": "/0", "minutes": 10},
|
||||
{"platform": "time_pattern", "hours": 12, "minutes": 0, "seconds": 100},
|
||||
)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user