From e3e755850fc51c3878a39af48ffce80be82445c6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 5 Sep 2026 12:12:33 +0200 Subject: [PATCH] Put the measured password cost in the warning --- esphome/components/esphome/ota/__init__.py | 9 +++++---- tests/component_tests/ota/test_esphome_ota.py | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/esphome/components/esphome/ota/__init__.py b/esphome/components/esphome/ota/__init__.py index 757bed89f9..4ccf86383c 100644 --- a/esphome/components/esphome/ota/__init__.py +++ b/esphome/components/esphome/ota/__init__.py @@ -131,10 +131,11 @@ def ota_esphome_final_validate(config: ConfigType) -> None: _resolve_encryption_key(encryption_conf, api_conf) elif CONF_PASSWORD in ota_conf and _api_static_key(api_conf) is not None: _LOGGER.warning( - "'%s' %s wastes flash and RAM: the '%s' %s %s already authenticates " - "and encrypts OTA uploads, the password only serves older clients " - "that do not support encryption; remove '%s' and add '%s' under " - "'%s' to require encryption", + "'%s' %s wastes significant flash and RAM (about 3.5 KB and 60 " + "bytes plus the password on the heap): the '%s' %s %s already " + "authenticates and encrypts OTA uploads, the password only serves " + "older clients that do not support encryption; remove '%s' and " + "add '%s' under '%s' to require encryption", CONF_OTA, CONF_PASSWORD, CONF_API, diff --git a/tests/component_tests/ota/test_esphome_ota.py b/tests/component_tests/ota/test_esphome_ota.py index 3673944080..7beec3e971 100644 --- a/tests/component_tests/ota/test_esphome_ota.py +++ b/tests/component_tests/ota/test_esphome_ota.py @@ -357,7 +357,7 @@ def test_password_with_api_key_warns(caplog: pytest.LogCaptureFixture) -> None: try: with caplog.at_level(logging.WARNING): ota_esphome_final_validate({}) - assert any("wastes flash and RAM" in r.message for r in caplog.records) + assert any("wastes significant flash" in r.message for r in caplog.records) finally: fv.full_config.reset(token) @@ -379,7 +379,7 @@ def test_password_without_static_api_key_no_warning( try: with caplog.at_level(logging.WARNING): ota_esphome_final_validate({}) - assert not any("wastes flash and RAM" in r.message for r in caplog.records) + assert not any("wastes significant flash" in r.message for r in caplog.records) finally: fv.full_config.reset(token)