From 70b54ab42212577dfdbaa2e7754f18036ba97eca Mon Sep 17 00:00:00 2001 From: hermlon Date: Fri, 13 Sep 2024 08:29:30 +0200 Subject: [PATCH] only activate WiFiClientSecure when skip cert true --- esphome/components/mqtt/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/esphome/components/mqtt/__init__.py b/esphome/components/mqtt/__init__.py index b9ff641a87..6294ee1a4b 100644 --- a/esphome/components/mqtt/__init__.py +++ b/esphome/components/mqtt/__init__.py @@ -401,7 +401,8 @@ async def to_code(config): cg.add(var.set_ssl_fingerprint(arr)) if CONF_SKIP_CERT_CN_CHECK in config: - cg.add_define("USE_MQTT_SECURE_CLIENT") + if config[CONF_SKIP_CERT_CN_CHECK]: + cg.add_define("USE_MQTT_SECURE_CLIENT") cg.add(var.set_skip_cert_cn_check(config[CONF_SKIP_CERT_CN_CHECK])) if CONF_CERTIFICATE_AUTHORITY in config: