From a12ba7bd3889ddfff1890728a1f032ee254f8c42 Mon Sep 17 00:00:00 2001 From: Samuel Sieb Date: Sat, 22 Apr 2023 00:41:12 -0700 Subject: [PATCH 1/3] fix flip_x (#4727) --- esphome/components/max7219digit/display.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/max7219digit/display.py b/esphome/components/max7219digit/display.py index faa8a08f4a..8db9123a39 100644 --- a/esphome/components/max7219digit/display.py +++ b/esphome/components/max7219digit/display.py @@ -93,7 +93,7 @@ async def to_code(config): cg.add(var.set_scroll(config[CONF_SCROLL_ENABLE])) cg.add(var.set_scroll_mode(config[CONF_SCROLL_MODE])) cg.add(var.set_reverse(config[CONF_REVERSE_ENABLE])) - cg.add(var.set_flip_x([CONF_FLIP_X])) + cg.add(var.set_flip_x(config[CONF_FLIP_X])) if CONF_LAMBDA in config: lambda_ = await cg.process_lambda( From 38ed38864eaf818ae988f6dc7136f07c9002fd63 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 24 Apr 2023 08:42:46 +1200 Subject: [PATCH 2/3] Use proper schema for delta filter (#4723) --- esphome/components/sensor/__init__.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/esphome/components/sensor/__init__.py b/esphome/components/sensor/__init__.py index ac25884697..f0a58d908c 100644 --- a/esphome/components/sensor/__init__.py +++ b/esphome/components/sensor/__init__.py @@ -25,10 +25,12 @@ from esphome.const import ( CONF_STATE_CLASS, CONF_TO, CONF_TRIGGER_ID, + CONF_TYPE, CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE, CONF_MQTT_ID, CONF_FORCE_UPDATE, + CONF_VALUE, DEVICE_CLASS_APPARENT_POWER, DEVICE_CLASS_AQI, DEVICE_CLASS_ATMOSPHERIC_PRESSURE, @@ -476,21 +478,38 @@ async def lambda_filter_to_code(config, filter_id): return cg.new_Pvariable(filter_id, lambda_) +DELTA_SCHEMA = cv.Schema( + { + cv.Required(CONF_VALUE): cv.positive_float, + cv.Optional(CONF_TYPE, default="absolute"): cv.one_of( + "absolute", "percentage", lower=True + ), + } +) + + def validate_delta(config): try: - return (cv.positive_float(config), False) + value = cv.positive_float(config) + return DELTA_SCHEMA({CONF_VALUE: value, CONF_TYPE: "absolute"}) except cv.Invalid: pass try: - return (cv.percentage(config), True) + value = cv.percentage(config) + return DELTA_SCHEMA({CONF_VALUE: value, CONF_TYPE: "percentage"}) except cv.Invalid: pass raise cv.Invalid("Delta filter requires a positive number or percentage value.") -@FILTER_REGISTRY.register("delta", DeltaFilter, validate_delta) +@FILTER_REGISTRY.register("delta", DeltaFilter, cv.Any(DELTA_SCHEMA, validate_delta)) async def delta_filter_to_code(config, filter_id): - return cg.new_Pvariable(filter_id, *config) + percentage = config[CONF_TYPE] == "percentage" + return cg.new_Pvariable( + filter_id, + config[CONF_VALUE], + percentage, + ) @FILTER_REGISTRY.register("or", OrFilter, validate_filters) From 96d208e0d806074f07278a42d77025a85f758de2 Mon Sep 17 00:00:00 2001 From: Jesse Hills <3060199+jesserockz@users.noreply.github.com> Date: Mon, 24 Apr 2023 09:11:07 +1200 Subject: [PATCH 3/3] Bump version to 2023.4.1 --- esphome/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/const.py b/esphome/const.py index 1e72c6d609..6796f8d606 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -1,6 +1,6 @@ """Constants used by esphome.""" -__version__ = "2023.4.0" +__version__ = "2023.4.1" ALLOWED_NAME_CHARS = "abcdefghijklmnopqrstuvwxyz0123456789-_"