mirror of
https://github.com/esphome/esphome.git
synced 2026-06-24 14:19:03 +00:00
[mqtt] Fix ESP-IDF 6.0 compatibility for external MQTT component (#14822)
This commit is contained in:
@@ -3,7 +3,9 @@ from esphome.automation import Condition
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import logger, socket
|
||||
from esphome.components.esp32 import (
|
||||
add_idf_component,
|
||||
add_idf_sdkconfig_option,
|
||||
idf_version,
|
||||
include_builtin_idf_component,
|
||||
)
|
||||
from esphome.config_helpers import filter_source_files_from_platform
|
||||
@@ -351,7 +353,11 @@ async def to_code(config):
|
||||
if CORE.is_esp32:
|
||||
socket.require_wake_loop_threadsafe()
|
||||
# Re-enable ESP-IDF's mqtt component (excluded by default to save compile time)
|
||||
include_builtin_idf_component("mqtt")
|
||||
# IDF 6.0 moved esp-mqtt to an external component
|
||||
if idf_version() >= cv.Version(6, 0, 0):
|
||||
add_idf_component(name="espressif/mqtt", ref="1.0.0")
|
||||
else:
|
||||
include_builtin_idf_component("mqtt")
|
||||
|
||||
cg.add_define("USE_MQTT")
|
||||
cg.add_global(mqtt_ns.using)
|
||||
|
||||
@@ -37,5 +37,9 @@ dependencies:
|
||||
version: 0.3.2
|
||||
rules:
|
||||
- if: "target in [esp32, esp32s2, esp32s3, esp32c6, esp32p4]"
|
||||
espressif/mqtt:
|
||||
version: "1.0.0"
|
||||
rules:
|
||||
- if: "idf_version >=6.0.0"
|
||||
esp32async/asynctcp:
|
||||
version: 3.4.91
|
||||
|
||||
Reference in New Issue
Block a user