Dont do mqtt ip lookup if use_address has ip address (#5096)

* Dont do mqtt ip lookup id `use_address` is in config

* Fix after actually testing =)
This commit is contained in:
Jesse Hills 2023-07-13 12:19:04 +12:00
parent 3ba2a29e54
commit d7945de001
No known key found for this signature in database
GPG Key ID: BEAAE804EFD8E83A

View File

@ -32,7 +32,7 @@ from esphome.const import (
SECRETS_FILES,
)
from esphome.core import CORE, EsphomeError, coroutine
from esphome.helpers import indent
from esphome.helpers import indent, is_ip_address
from esphome.util import (
run_external_command,
run_external_process,
@ -308,8 +308,10 @@ def upload_program(config, args, host):
password = ota_conf.get(CONF_PASSWORD, "")
if (
get_port_type(host) == "MQTT" or config[CONF_MDNS][CONF_DISABLED]
) and CONF_MQTT in config:
not is_ip_address(CORE.address)
and (get_port_type(host) == "MQTT" or config[CONF_MDNS][CONF_DISABLED])
and CONF_MQTT in config
):
from esphome import mqtt
host = mqtt.get_esphome_device_ip(