1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-19 00:05:43 +00:00

Enable IPv6 for ESP8266 and Raspberry pi pico w (RP2040) (#4759)

This commit is contained in:
Jimmy Hedman
2023-09-12 22:05:02 +02:00
committed by GitHub
parent fc354eec0e
commit dadbc1aefa
9 changed files with 41 additions and 34 deletions

View File

@@ -273,8 +273,8 @@ async def to_code(config):
await cg.register_component(var, config)
# Add required libraries for ESP8266
if CORE.is_esp8266:
# https://github.com/OttoWinter/async-mqtt-client/blob/master/library.json
cg.add_library("ottowinter/AsyncMqttClient-esphome", "0.8.6")
# https://github.com/heman/async-mqtt-client/blob/master/library.json
cg.add_library("heman/AsyncMqttClient-esphome", "1.0.0")
cg.add_define("USE_MQTT")
cg.add_global(mqtt_ns.using)

View File

@@ -168,15 +168,10 @@ void MQTTClientComponent::start_dnslookup_() {
case ERR_OK: {
// Got IP immediately
this->dns_resolved_ = true;
#ifdef USE_ESP32
#if LWIP_IPV6
this->ip_ = addr.u_addr.ip4.addr;
#else
this->ip_ = addr.addr;
#endif
#endif
#ifdef USE_ESP8266
this->ip_ = addr.addr;
#endif
this->start_connect_();
return;
@@ -228,15 +223,10 @@ void MQTTClientComponent::dns_found_callback(const char *name, const ip_addr_t *
if (ipaddr == nullptr) {
a_this->dns_resolve_error_ = true;
} else {
#ifdef USE_ESP32
#if LWIP_IPV6
a_this->ip_ = ipaddr->u_addr.ip4.addr;
#else
a_this->ip_ = ipaddr->addr;
#endif
#endif // USE_ESP32
#ifdef USE_ESP8266
a_this->ip_ = ipaddr->addr;
#endif
a_this->dns_resolved_ = true;
}