1
0
mirror of https://github.com/esphome/esphome.git synced 2025-04-11 05:10:34 +01:00

small fix

This commit is contained in:
Tomasz Duda 2024-05-16 19:10:05 +02:00
parent 957e01f466
commit 3fb301ff1f

View File

@ -119,28 +119,25 @@ def choose_upload_log_host(
raise EsphomeError("PYOCD for adafruit is not implemented")
options = [("pyocd", "PYOCD")]
return choose_prompt(options, purpose=purpose)
if mcuboot:
if show_ota and ota:
if default:
options.append(
(f"OTA over Bluetooth LE ({default})", f"mcumgr {default}")
)
return choose_prompt(options, purpose=purpose)
ble_devices = asyncio.run(smpmgr_scan(CORE.config["esphome"]["name"]))
if len(ble_devices) == 0:
_LOGGER.warning("No OTA over Bluetooth LE service found!")
for device in ble_devices:
options.append(
(
f"OTA over Bluetooth LE({device.address}) {device.name}",
f"mcumgr {device.address}",
)
)
else:
if not mcuboot:
if (show_ota and ota) or (show_api and "api" in CORE.config):
options.append((f"Over The Air ({CORE.address})", CORE.address))
if default == "OTA":
return CORE.address
elif show_ota and ota:
if default:
options.append((f"OTA over Bluetooth LE ({default})", f"mcumgr {default}"))
return choose_prompt(options, purpose=purpose)
ble_devices = asyncio.run(smpmgr_scan(CORE.config["esphome"]["name"]))
if len(ble_devices) == 0:
_LOGGER.warning("No OTA over Bluetooth LE service found!")
for device in ble_devices:
options.append(
(
f"OTA over Bluetooth LE({device.address}) {device.name}",
f"mcumgr {device.address}",
)
)
if show_mqtt and CONF_MQTT in CORE.config:
options.append((f"MQTT ({CORE.config['mqtt'][CONF_BROKER]})", "MQTT"))
if default == "OTA":