diff --git a/homeassistant/helpers/selector.py b/homeassistant/helpers/selector.py index 1ae0082c06f..87574949f4e 100644 --- a/homeassistant/helpers/selector.py +++ b/homeassistant/helpers/selector.py @@ -704,7 +704,9 @@ class SelectSelector(Selector): vol.Required("options"): vol.All(vol.Any([str], [select_option])), vol.Optional("multiple", default=False): cv.boolean, vol.Optional("custom_value", default=False): cv.boolean, - vol.Optional("mode"): vol.Coerce(SelectSelectorMode), + vol.Optional("mode"): vol.All( + vol.Coerce(SelectSelectorMode), lambda val: val.value + ), } ) @@ -827,7 +829,9 @@ class TextSelector(Selector): vol.Optional("suffix"): str, # The "type" controls the input field in the browser, the resulting # data can be any string so we don't validate it. - vol.Optional("type"): vol.Coerce(TextSelectorType), + vol.Optional("type"): vol.All( + vol.Coerce(TextSelectorType), lambda val: val.value + ), } ) diff --git a/tests/helpers/test_selector.py b/tests/helpers/test_selector.py index ed831026065..4cb924a520e 100644 --- a/tests/helpers/test_selector.py +++ b/tests/helpers/test_selector.py @@ -351,7 +351,7 @@ def test_object_selector_schema(schema, valid_selections, invalid_selections): ( ({}, ("abc123",), (None,)), ({"multiline": True}, (), ()), - ({"multiline": False}, (), ()), + ({"multiline": False, "type": "email"}, (), ()), ), ) def test_text_selector_schema(schema, valid_selections, invalid_selections): @@ -402,7 +402,7 @@ def test_text_selector_schema(schema, valid_selections, invalid_selections): (0, None, ["red"]), ), ( - {"options": [], "custom_value": True, "multiple": True}, + {"options": [], "custom_value": True, "multiple": True, "mode": "list"}, (["red"], ["green", "blue"], []), (0, None, "red"), ),