Add enable_day to duration selector (#68705)

pull/68732/head
Franck Nijhof 2022-03-27 06:31:22 +02:00 committed by GitHub
parent 4e9430cba5
commit a2a612c640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -207,7 +207,11 @@ class DurationSelector(Selector):
selector_type = "duration"
CONFIG_SCHEMA = vol.Schema({})
CONFIG_SCHEMA = vol.Schema(
{
vol.Optional("enable_day"): cv.boolean,
}
)
def __call__(self, data: Any) -> dict[str, float]:
"""Validate the passed selection."""

View File

@ -384,6 +384,11 @@ def test_attribute_selector_schema(schema, valid_selections, invalid_selections)
({"seconds": 10},),
(None, {}),
),
(
{"enable_day": True},
({"seconds": 10},),
(None, {}),
),
),
)
def test_duration_selector_schema(schema, valid_selections, invalid_selections):