diff --git a/homeassistant/helpers/selector.py b/homeassistant/helpers/selector.py index e529cac096c..93f771d5bd6 100644 --- a/homeassistant/helpers/selector.py +++ b/homeassistant/helpers/selector.py @@ -207,8 +207,11 @@ class NumberSelector(Selector): has_min_max_if_slider, ) - def __call__(self, data: Any) -> float: + def __call__(self, data: Any) -> float | None: """Validate the passed selection.""" + if data is None: + return data + value: float = vol.Coerce(float)(data) if "min" in self.config and value < self.config["min"]: diff --git a/tests/helpers/test_selector.py b/tests/helpers/test_selector.py index 88820de9eef..fdd2e0cf112 100644 --- a/tests/helpers/test_selector.py +++ b/tests/helpers/test_selector.py @@ -208,7 +208,8 @@ def test_area_selector_schema(schema, valid_selections, invalid_selections): (), ), ({"min": 10, "max": 1000, "mode": "slider", "step": 0.5}, (), ()), - ({"mode": "box"}, (10,), ()), + ({"mode": "box"}, (10, None), ("cat")), + ({"mode": "slider", "min": -100, "max": 100}, (10, None), ("cat")), ), ) def test_number_selector_schema(schema, valid_selections, invalid_selections):