This commit is contained in:
Mat931
2026-04-16 19:44:25 +02:00
parent 4b4d9a13f6
commit aca11f1777
3 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -163,7 +163,7 @@ async def to_code(config: ConfigType) -> None:
cg.add_define("USE_OTA_PASSWORD")
cg.add_define("USE_OTA_VERSION", config[CONF_VERSION])
if config[CONF_ALLOW_PARTITION_ACCESS]:
if config.get(CONF_ALLOW_PARTITION_ACCESS, False):
cg.add_define("USE_OTA_PARTITIONS")
# Build flag so lwip_fast_select.c (a .c file that can't include defines.h) sees it.
+3 -3
View File
@@ -242,7 +242,7 @@ def perform_ota(
password: str | None,
file_handle: io.IOBase,
filename: Path,
ota_type: int,
ota_type: int = OTA_TYPE_UPDATE_APP,
) -> None:
file_contents = file_handle.read()
file_size = len(file_contents)
@@ -413,7 +413,7 @@ def run_ota_impl_(
remote_port: int,
password: str | None,
filename: Path,
ota_type: int,
ota_type: int = OTA_TYPE_UPDATE_APP,
) -> tuple[int, str | None]:
from esphome.core import CORE
@@ -470,7 +470,7 @@ def run_ota(
remote_port: int,
password: str | None,
filename: Path,
ota_type: int,
ota_type: int = OTA_TYPE_UPDATE_APP,
) -> tuple[int, str | None]:
try:
return run_ota_impl_(remote_host, remote_port, password, filename, ota_type)
+7 -7
View File
@@ -1587,7 +1587,7 @@ def test_upload_program_ota_success(
tmp_path / ".esphome" / "build" / "test" / ".pioenvs" / "test" / "firmware.bin"
)
mock_run_ota.assert_called_once_with(
["192.168.1.100"], 3232, "secret", expected_firmware
["192.168.1.100"], 3232, "secret", expected_firmware, 0
)
@@ -1618,7 +1618,7 @@ def test_upload_program_ota_with_file_arg(
assert exit_code == 0
assert host == "192.168.1.100"
mock_run_ota.assert_called_once_with(
["192.168.1.100"], 3232, None, Path("custom.bin")
["192.168.1.100"], 3232, None, Path("custom.bin"), 0
)
@@ -1676,7 +1676,7 @@ def test_upload_program_ota_with_mqtt_resolution(
tmp_path / ".esphome" / "build" / "test" / ".pioenvs" / "test" / "firmware.bin"
)
mock_run_ota.assert_called_once_with(
["192.168.1.100"], 3232, None, expected_firmware
["192.168.1.100"], 3232, None, expected_firmware, 0
)
@@ -1724,7 +1724,7 @@ def test_upload_program_ota_with_mqtt_empty_broker(
tmp_path / ".esphome" / "build" / "test" / ".pioenvs" / "test" / "firmware.bin"
)
mock_run_ota.assert_called_once_with(
["192.168.1.50"], 3232, None, expected_firmware
["192.168.1.50"], 3232, None, expected_firmware, 0
)
# Verify warning was logged
assert "MQTT IP discovery failed" in caplog.text
@@ -2698,7 +2698,7 @@ def test_upload_program_ota_static_ip_with_mqttip(
tmp_path / ".esphome" / "build" / "test" / ".pioenvs" / "test" / "firmware.bin"
)
mock_run_ota.assert_called_once_with(
["192.168.1.100", "192.168.2.50"], 3232, None, expected_firmware
["192.168.1.100", "192.168.2.50"], 3232, None, expected_firmware, 0
)
@@ -2741,7 +2741,7 @@ def test_upload_program_ota_multiple_mqttip_resolves_once(
tmp_path / ".esphome" / "build" / "test" / ".pioenvs" / "test" / "firmware.bin"
)
mock_run_ota.assert_called_once_with(
["192.168.2.50", "192.168.2.51", "192.168.1.100"], 3232, None, expected_firmware
["192.168.2.50", "192.168.2.51", "192.168.1.100"], 3232, None, expected_firmware, 0
)
@@ -2906,7 +2906,7 @@ def test_upload_program_ota_mqtt_timeout_fallback(
tmp_path / ".esphome" / "build" / "test" / ".pioenvs" / "test" / "firmware.bin"
)
mock_run_ota.assert_called_once_with(
["192.168.1.100"], 3232, None, expected_firmware
["192.168.1.100"], 3232, None, expected_firmware, 0
)