diff --git a/script/build_language_schema.py b/script/build_language_schema.py index 6e4000e06e..025186299d 100755 --- a/script/build_language_schema.py +++ b/script/build_language_schema.py @@ -924,9 +924,14 @@ def convert(schema, config_var, path): config_var[S_TYPE] = "enum" config_var["values"] = dict.fromkeys(list(data.keys())) elif schema_type == "maybe": - config_var[S_TYPE] = S_SCHEMA + # maybe_simple_value: either a scalar shorthand (mapped to the key in + # data[1]) or the full wrapped schema. The wrapped schema is usually a + # plain Schema (converts to a "schema" config var), but may be something + # else, e.g. a typed_schema (converts to a "typed" config var with + # "types" and no top-level "schema" key). Merge whatever it produced + # rather than assuming a "schema" key is present. config_var["maybe"] = data[1] - config_var["schema"] = convert_config(data[0], path + "/maybe")["schema"] + config_var.update(convert_config(data[0], path + "/maybe")) # esphome/on_boot elif schema_type == "automation": extra_schema = None