1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-22 11:43:51 +01:00

[openthread] Backport address resolution support to prevent OTA crash (#11312)

Co-authored-by: Daniel Stiner <danstiner@gmail.com>
This commit is contained in:
J. Nick Koston
2025-10-19 11:12:56 -10:00
committed by GitHub
parent a186c1062f
commit 87ca8784ef
2 changed files with 11 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ from esphome.const import (
CONF_COMMENT, CONF_COMMENT,
CONF_ESPHOME, CONF_ESPHOME,
CONF_ETHERNET, CONF_ETHERNET,
CONF_OPENTHREAD,
CONF_PORT, CONF_PORT,
CONF_USE_ADDRESS, CONF_USE_ADDRESS,
CONF_WEB_SERVER, CONF_WEB_SERVER,
@@ -641,6 +642,9 @@ class EsphomeCore:
if CONF_ETHERNET in self.config: if CONF_ETHERNET in self.config:
return self.config[CONF_ETHERNET][CONF_USE_ADDRESS] return self.config[CONF_ETHERNET][CONF_USE_ADDRESS]
if CONF_OPENTHREAD in self.config:
return f"{self.name}.local"
return None return None
@property @property

View File

@@ -570,6 +570,13 @@ class TestEsphomeCore:
assert target.address == "4.3.2.1" assert target.address == "4.3.2.1"
def test_address__openthread(self, target):
target.name = "test-device"
target.config = {}
target.config[const.CONF_OPENTHREAD] = {}
assert target.address == "test-device.local"
def test_is_esp32(self, target): def test_is_esp32(self, target):
target.data[const.KEY_CORE] = {const.KEY_TARGET_PLATFORM: "esp32"} target.data[const.KEY_CORE] = {const.KEY_TARGET_PLATFORM: "esp32"}