Invalid config for waveshare models with no full_update_every (#4066)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Dennis 2022-12-06 23:53:20 +01:00 committed by GitHub
parent 9370ff3dfa
commit f83f1bff19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,13 +88,17 @@ MODELS = {
} }
def validate_full_update_every_only_type_a(value): def validate_full_update_every_only_types_ac(value):
if CONF_FULL_UPDATE_EVERY not in value: if CONF_FULL_UPDATE_EVERY not in value:
return value return value
if MODELS[value[CONF_MODEL]][0] == "b": if MODELS[value[CONF_MODEL]][0] == "b":
full_models = []
for key, val in sorted(MODELS.items()):
if val[0] != "b":
full_models.append(key)
raise cv.Invalid( raise cv.Invalid(
"The 'full_update_every' option is only available for models " "The 'full_update_every' option is only available for models "
"'1.54in', '1.54inV2', '2.13in', '2.90in', and '2.90inV2'." + ", ".join(full_models)
) )
return value return value
@ -116,7 +120,7 @@ CONFIG_SCHEMA = cv.All(
) )
.extend(cv.polling_component_schema("1s")) .extend(cv.polling_component_schema("1s"))
.extend(spi.spi_device_schema()), .extend(spi.spi_device_schema()),
validate_full_update_every_only_type_a, validate_full_update_every_only_types_ac,
cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA), cv.has_at_most_one_key(CONF_PAGES, CONF_LAMBDA),
) )