From a2a612c6406be4f34e43e8d9c54926f0e29c84d2 Mon Sep 17 00:00:00 2001 From: Franck Nijhof Date: Sun, 27 Mar 2022 06:31:22 +0200 Subject: [PATCH] Add enable_day to duration selector (#68705) --- homeassistant/helpers/selector.py | 6 +++++- tests/helpers/test_selector.py | 5 +++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/helpers/selector.py b/homeassistant/helpers/selector.py index 1652e2110f4..3da4ccd1880 100644 --- a/homeassistant/helpers/selector.py +++ b/homeassistant/helpers/selector.py @@ -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.""" diff --git a/tests/helpers/test_selector.py b/tests/helpers/test_selector.py index e9e70f15fad..5a2bc0c0baa 100644 --- a/tests/helpers/test_selector.py +++ b/tests/helpers/test_selector.py @@ -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):