From d294d2d721a385547814ba9a697dda6e89babd46 Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 13 Aug 2024 22:14:14 +0200 Subject: [PATCH] Update esphome/components/waveshare_epaper/display.py Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com> --- esphome/components/waveshare_epaper/display.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/esphome/components/waveshare_epaper/display.py b/esphome/components/waveshare_epaper/display.py index bbcbfc1fc6..5edd521c3e 100644 --- a/esphome/components/waveshare_epaper/display.py +++ b/esphome/components/waveshare_epaper/display.py @@ -210,10 +210,10 @@ async def to_code(config): dc = await cg.gpio_pin_expression(config[CONF_DC_PIN]) cg.add(var.set_dc_pin(dc)) - if CONF_NUM_SEGMENTS_X in config: - cg.add(var.set_num_segments_x(config["num_segments_x"])) - if CONF_NUM_SEGMENTS_Y in config: - cg.add(var.set_num_segments_y(config["num_segments_y"])) + if num_segments_x := config.get(CONF_NUM_SEGMENTS_X): + cg.add(var.set_num_segments_x(num_segments_x)) + if num_segments_y := config.get(CONF_NUM_SEGMENTS_Y): + cg.add(var.set_num_segments_y(num_segments_y)) if CONF_LAMBDA in config: lambda_ = await cg.process_lambda( config[CONF_LAMBDA], [(display.DisplayRef, "it")], return_type=cg.void