From f83f1bff19fec8ed19df9aa6ae29a89150a704c2 Mon Sep 17 00:00:00 2001 From: Dennis Date: Tue, 6 Dec 2022 23:53:20 +0100 Subject: [PATCH] Invalid config for waveshare models with no full_update_every (#4066) Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- esphome/components/waveshare_epaper/display.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/esphome/components/waveshare_epaper/display.py b/esphome/components/waveshare_epaper/display.py index a9d8350404..46da3f6fb4 100644 --- a/esphome/components/waveshare_epaper/display.py +++ b/esphome/components/waveshare_epaper/display.py @@ -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: return value 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( "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 @@ -116,7 +120,7 @@ CONFIG_SCHEMA = cv.All( ) .extend(cv.polling_component_schema("1s")) .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), )