diff --git a/esphome/components/esphome/ota/__init__.py b/esphome/components/esphome/ota/__init__.py index 1aced2847b..942704dfef 100644 --- a/esphome/components/esphome/ota/__init__.py +++ b/esphome/components/esphome/ota/__init__.py @@ -290,6 +290,11 @@ FILTER_SOURCE_FILES = filter_source_files_from_defines( ) +def enable_deflate() -> None: + """Compile the on-the-fly inflater for compressed uploads.""" + cg.add_define("USE_OTA_DEFLATE") + + @coroutine_with_priority(CoroPriority.OTA_UPDATES) async def to_code(config: ConfigType) -> None: var = cg.new_Pvariable(config[CONF_ID]) @@ -310,7 +315,7 @@ async def to_code(config: ConfigType) -> None: # ESP8266 and RP2040 inflate gzip at reboot; the rest inflate on the fly if not (CORE.is_esp8266 or CORE.is_rp2): - cg.add_define("USE_OTA_DEFLATE") + enable_deflate() # One key per device: an api encryption block supplies it (static or # runtime) and offers; the ota block only adds the requirement