diff --git a/homeassistant/helpers/selector.py b/homeassistant/helpers/selector.py index 764f8ed49af..9577381d92b 100644 --- a/homeassistant/helpers/selector.py +++ b/homeassistant/helpers/selector.py @@ -277,6 +277,8 @@ class DurationSelector(Selector): CONFIG_SCHEMA = vol.Schema( { + # Enable day field in frontend. A selection with `days` set is allowed + # even if `enable_day` is not set vol.Optional("enable_day"): cv.boolean, } ) diff --git a/tests/helpers/test_selector.py b/tests/helpers/test_selector.py index f1d7c83f211..9e68af05487 100644 --- a/tests/helpers/test_selector.py +++ b/tests/helpers/test_selector.py @@ -406,12 +406,15 @@ def test_attribute_selector_schema(schema, valid_selections, invalid_selections) ( ( {}, - ({"seconds": 10},), + ( + {"seconds": 10}, + {"days": 10}, # Days is allowed also if `enable_day` is not set + ), (None, {}), ), ( {"enable_day": True}, - ({"seconds": 10},), + ({"seconds": 10}, {"days": 10}), (None, {}), ), ),