2023-11-15 05:14:37 +01:00
|
|
|
from __future__ import annotations
|
|
|
|
|
|
|
|
import gzip
|
2018-10-14 19:14:28 +02:00
|
|
|
import hashlib
|
2023-11-15 05:14:37 +01:00
|
|
|
import io
|
2018-10-14 19:14:28 +02:00
|
|
|
import logging
|
|
|
|
import random
|
|
|
|
import socket
|
|
|
|
import sys
|
2018-12-18 19:31:43 +01:00
|
|
|
import time
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2019-02-13 16:54:02 +01:00
|
|
|
from esphome.core import EsphomeError
|
|
|
|
from esphome.helpers import is_ip_address, resolve_ip_address
|
2018-11-07 22:41:54 +01:00
|
|
|
|
2024-01-19 05:18:06 +01:00
|
|
|
RESPONSE_OK = 0x00
|
|
|
|
RESPONSE_REQUEST_AUTH = 0x01
|
|
|
|
|
|
|
|
RESPONSE_HEADER_OK = 0x40
|
|
|
|
RESPONSE_AUTH_OK = 0x41
|
|
|
|
RESPONSE_UPDATE_PREPARE_OK = 0x42
|
|
|
|
RESPONSE_BIN_MD5_OK = 0x43
|
|
|
|
RESPONSE_RECEIVE_OK = 0x44
|
|
|
|
RESPONSE_UPDATE_END_OK = 0x45
|
|
|
|
RESPONSE_SUPPORTS_COMPRESSION = 0x46
|
|
|
|
RESPONSE_CHUNK_OK = 0x47
|
|
|
|
|
|
|
|
RESPONSE_ERROR_MAGIC = 0x80
|
|
|
|
RESPONSE_ERROR_UPDATE_PREPARE = 0x81
|
|
|
|
RESPONSE_ERROR_AUTH_INVALID = 0x82
|
|
|
|
RESPONSE_ERROR_WRITING_FLASH = 0x83
|
|
|
|
RESPONSE_ERROR_UPDATE_END = 0x84
|
|
|
|
RESPONSE_ERROR_INVALID_BOOTSTRAPPING = 0x85
|
|
|
|
RESPONSE_ERROR_WRONG_CURRENT_FLASH_CONFIG = 0x86
|
|
|
|
RESPONSE_ERROR_WRONG_NEW_FLASH_CONFIG = 0x87
|
|
|
|
RESPONSE_ERROR_ESP8266_NOT_ENOUGH_SPACE = 0x88
|
|
|
|
RESPONSE_ERROR_ESP32_NOT_ENOUGH_SPACE = 0x89
|
|
|
|
RESPONSE_ERROR_NO_UPDATE_PARTITION = 0x8A
|
|
|
|
RESPONSE_ERROR_MD5_MISMATCH = 0x8B
|
|
|
|
RESPONSE_ERROR_UNKNOWN = 0xFF
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
OTA_VERSION_1_0 = 1
|
2024-01-19 05:18:06 +01:00
|
|
|
OTA_VERSION_2_0 = 2
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
MAGIC_BYTES = [0x6C, 0x26, 0xF7, 0x5C, 0x45]
|
|
|
|
|
2021-10-22 13:02:55 +02:00
|
|
|
FEATURE_SUPPORTS_COMPRESSION = 0x01
|
|
|
|
|
2023-11-15 05:14:37 +01:00
|
|
|
|
|
|
|
UPLOAD_BLOCK_SIZE = 8192
|
|
|
|
UPLOAD_BUFFER_SIZE = UPLOAD_BLOCK_SIZE * 8
|
|
|
|
|
2018-10-14 19:14:28 +02:00
|
|
|
_LOGGER = logging.getLogger(__name__)
|
|
|
|
|
|
|
|
|
2019-12-07 18:28:55 +01:00
|
|
|
class ProgressBar:
|
2018-12-05 21:22:06 +01:00
|
|
|
def __init__(self):
|
|
|
|
self.last_progress = None
|
|
|
|
|
|
|
|
def update(self, progress):
|
|
|
|
bar_length = 60
|
|
|
|
status = ""
|
|
|
|
if progress >= 1:
|
|
|
|
progress = 1
|
|
|
|
status = "Done...\r\n"
|
|
|
|
new_progress = int(progress * 100)
|
|
|
|
if new_progress == self.last_progress:
|
|
|
|
return
|
|
|
|
self.last_progress = new_progress
|
|
|
|
block = int(round(bar_length * progress))
|
2021-09-19 19:22:28 +02:00
|
|
|
text = f"\rUploading: [{'=' * block + ' ' * (bar_length - block)}] {new_progress}% {status}"
|
2018-12-05 21:22:06 +01:00
|
|
|
sys.stderr.write(text)
|
|
|
|
sys.stderr.flush()
|
|
|
|
|
|
|
|
def done(self):
|
2021-03-07 20:03:16 +01:00
|
|
|
sys.stderr.write("\n")
|
2018-12-05 21:22:06 +01:00
|
|
|
sys.stderr.flush()
|
|
|
|
|
|
|
|
|
2019-02-13 16:54:02 +01:00
|
|
|
class OTAError(EsphomeError):
|
2018-10-14 19:14:28 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def recv_decode(sock, amount, decode=True):
|
|
|
|
data = sock.recv(amount)
|
|
|
|
if not decode:
|
|
|
|
return data
|
2019-12-07 18:28:55 +01:00
|
|
|
return list(data)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
def receive_exactly(sock, amount, msg, expect, decode=True):
|
|
|
|
if decode:
|
|
|
|
data = []
|
2019-01-03 19:54:36 +01:00
|
|
|
else:
|
2021-03-07 20:03:16 +01:00
|
|
|
data = b""
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
try:
|
|
|
|
data += recv_decode(sock, 1, decode=decode)
|
2019-12-07 18:28:55 +01:00
|
|
|
except OSError as err:
|
2020-09-16 12:12:40 +02:00
|
|
|
raise OTAError(f"Error receiving acknowledge {msg}: {err}") from err
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
try:
|
|
|
|
check_error(data, expect)
|
2018-11-10 11:45:38 +01:00
|
|
|
except OTAError as err:
|
2018-10-14 19:14:28 +02:00
|
|
|
sock.close()
|
2020-09-16 12:12:40 +02:00
|
|
|
raise OTAError(f"Error {msg}: {err}") from err
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
while len(data) < amount:
|
|
|
|
try:
|
|
|
|
data += recv_decode(sock, amount - len(data), decode=decode)
|
2019-12-07 18:28:55 +01:00
|
|
|
except OSError as err:
|
2020-09-16 12:12:40 +02:00
|
|
|
raise OTAError(f"Error receiving {msg}: {err}") from err
|
2018-10-14 19:14:28 +02:00
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
def check_error(data, expect):
|
|
|
|
if not expect:
|
|
|
|
return
|
|
|
|
dat = data[0]
|
|
|
|
if dat == RESPONSE_ERROR_MAGIC:
|
|
|
|
raise OTAError("Error: Invalid magic byte")
|
|
|
|
if dat == RESPONSE_ERROR_UPDATE_PREPARE:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: Couldn't prepare flash memory for update. Is the binary too big? "
|
|
|
|
"Please try restarting the ESP."
|
|
|
|
)
|
2018-10-14 19:14:28 +02:00
|
|
|
if dat == RESPONSE_ERROR_AUTH_INVALID:
|
|
|
|
raise OTAError("Error: Authentication invalid. Is the password correct?")
|
|
|
|
if dat == RESPONSE_ERROR_WRITING_FLASH:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: Wring OTA data to flash memory failed. See USB logs for more "
|
|
|
|
"information."
|
|
|
|
)
|
2018-10-14 19:14:28 +02:00
|
|
|
if dat == RESPONSE_ERROR_UPDATE_END:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: Finishing update failed. See the MQTT/USB logs for more "
|
|
|
|
"information."
|
|
|
|
)
|
2018-10-14 19:14:28 +02:00
|
|
|
if dat == RESPONSE_ERROR_INVALID_BOOTSTRAPPING:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: Please press the reset button on the ESP. A manual reset is "
|
|
|
|
"required on the first OTA-Update after flashing via USB."
|
|
|
|
)
|
2019-02-10 16:43:44 +01:00
|
|
|
if dat == RESPONSE_ERROR_WRONG_CURRENT_FLASH_CONFIG:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: ESP has been flashed with wrong flash size. Please choose the "
|
|
|
|
"correct 'board' option (esp01_1m always works) and then flash over USB."
|
|
|
|
)
|
2019-02-10 16:43:44 +01:00
|
|
|
if dat == RESPONSE_ERROR_WRONG_NEW_FLASH_CONFIG:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: ESP does not have the requested flash size (wrong board). Please "
|
|
|
|
"choose the correct 'board' option (esp01_1m always works) and try "
|
|
|
|
"uploading again."
|
|
|
|
)
|
2019-02-10 16:43:44 +01:00
|
|
|
if dat == RESPONSE_ERROR_ESP8266_NOT_ENOUGH_SPACE:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: ESP does not have enough space to store OTA file. Please try "
|
|
|
|
"flashing a minimal firmware (remove everything except ota)"
|
|
|
|
)
|
2019-02-10 16:43:44 +01:00
|
|
|
if dat == RESPONSE_ERROR_ESP32_NOT_ENOUGH_SPACE:
|
2021-03-07 20:03:16 +01:00
|
|
|
raise OTAError(
|
|
|
|
"Error: The OTA partition on the ESP is too small. ESPHome needs to resize "
|
|
|
|
"this partition, please flash over USB."
|
|
|
|
)
|
2022-08-16 11:51:05 +02:00
|
|
|
if dat == RESPONSE_ERROR_NO_UPDATE_PARTITION:
|
|
|
|
raise OTAError(
|
|
|
|
"Error: The OTA partition on the ESP couldn't be found. ESPHome needs to create "
|
|
|
|
"this partition, please flash over USB."
|
|
|
|
)
|
|
|
|
if dat == RESPONSE_ERROR_MD5_MISMATCH:
|
|
|
|
raise OTAError(
|
|
|
|
"Error: Application MD5 code mismatch. Please try again "
|
|
|
|
"or flash over USB with a good quality cable."
|
|
|
|
)
|
2018-10-14 19:14:28 +02:00
|
|
|
if dat == RESPONSE_ERROR_UNKNOWN:
|
|
|
|
raise OTAError("Unknown error from ESP")
|
|
|
|
if not isinstance(expect, (list, tuple)):
|
|
|
|
expect = [expect]
|
|
|
|
if dat not in expect:
|
2021-09-19 19:22:28 +02:00
|
|
|
raise OTAError(f"Unexpected response from ESP: 0x{data[0]:02X}")
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
def send_check(sock, data, msg):
|
|
|
|
try:
|
2019-12-07 18:28:55 +01:00
|
|
|
if isinstance(data, (list, tuple)):
|
|
|
|
data = bytes(data)
|
|
|
|
elif isinstance(data, int):
|
|
|
|
data = bytes([data])
|
|
|
|
elif isinstance(data, str):
|
2021-03-07 20:03:16 +01:00
|
|
|
data = data.encode("utf8")
|
2019-01-03 16:05:33 +01:00
|
|
|
|
2018-11-13 15:31:14 +01:00
|
|
|
sock.sendall(data)
|
2019-12-07 18:28:55 +01:00
|
|
|
except OSError as err:
|
2020-09-16 12:12:40 +02:00
|
|
|
raise OTAError(f"Error sending {msg}: {err}") from err
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
|
2023-11-15 05:14:37 +01:00
|
|
|
def perform_ota(
|
|
|
|
sock: socket.socket, password: str, file_handle: io.IOBase, filename: str
|
|
|
|
) -> None:
|
2021-10-22 13:02:55 +02:00
|
|
|
file_contents = file_handle.read()
|
|
|
|
file_size = len(file_contents)
|
2021-03-07 20:03:16 +01:00
|
|
|
_LOGGER.info("Uploading %s (%s bytes)", filename, file_size)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2018-11-13 15:31:14 +01:00
|
|
|
# Enable nodelay, we need it for phase 1
|
|
|
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
2021-03-07 20:03:16 +01:00
|
|
|
send_check(sock, MAGIC_BYTES, "magic bytes")
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2021-03-07 20:03:16 +01:00
|
|
|
_, version = receive_exactly(sock, 2, "version", RESPONSE_OK)
|
2024-01-19 05:18:06 +01:00
|
|
|
_LOGGER.debug("Device support OTA version: %s", version)
|
2024-02-22 02:35:21 +01:00
|
|
|
supported_versions = (OTA_VERSION_1_0, OTA_VERSION_2_0)
|
|
|
|
if version not in supported_versions:
|
|
|
|
raise OTAError(
|
|
|
|
f"Device uses unsupported OTA version {version}, this ESPHome supports {supported_versions}"
|
|
|
|
)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
# Features
|
2021-10-22 13:02:55 +02:00
|
|
|
send_check(sock, FEATURE_SUPPORTS_COMPRESSION, "features")
|
|
|
|
features = receive_exactly(
|
|
|
|
sock, 1, "features", [RESPONSE_HEADER_OK, RESPONSE_SUPPORTS_COMPRESSION]
|
|
|
|
)[0]
|
|
|
|
|
|
|
|
if features == RESPONSE_SUPPORTS_COMPRESSION:
|
|
|
|
upload_contents = gzip.compress(file_contents, compresslevel=9)
|
|
|
|
_LOGGER.info("Compressed to %s bytes", len(upload_contents))
|
|
|
|
else:
|
|
|
|
upload_contents = file_contents
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2021-03-07 20:03:16 +01:00
|
|
|
(auth,) = receive_exactly(
|
|
|
|
sock, 1, "auth", [RESPONSE_REQUEST_AUTH, RESPONSE_AUTH_OK]
|
|
|
|
)
|
2018-10-14 19:14:28 +02:00
|
|
|
if auth == RESPONSE_REQUEST_AUTH:
|
|
|
|
if not password:
|
|
|
|
raise OTAError("ESP requests password, but no password given!")
|
2021-03-07 20:03:16 +01:00
|
|
|
nonce = receive_exactly(
|
|
|
|
sock, 32, "authentication nonce", [], decode=False
|
|
|
|
).decode()
|
2018-10-14 19:14:28 +02:00
|
|
|
_LOGGER.debug("Auth: Nonce is %s", nonce)
|
|
|
|
cnonce = hashlib.md5(str(random.random()).encode()).hexdigest()
|
|
|
|
_LOGGER.debug("Auth: CNonce is %s", cnonce)
|
|
|
|
|
2021-03-07 20:03:16 +01:00
|
|
|
send_check(sock, cnonce, "auth cnonce")
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
result_md5 = hashlib.md5()
|
2021-03-07 20:03:16 +01:00
|
|
|
result_md5.update(password.encode("utf-8"))
|
2018-10-14 19:14:28 +02:00
|
|
|
result_md5.update(nonce.encode())
|
|
|
|
result_md5.update(cnonce.encode())
|
|
|
|
result = result_md5.hexdigest()
|
|
|
|
_LOGGER.debug("Auth: Result is %s", result)
|
|
|
|
|
2021-03-07 20:03:16 +01:00
|
|
|
send_check(sock, result, "auth result")
|
|
|
|
receive_exactly(sock, 1, "auth result", RESPONSE_AUTH_OK)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2021-10-22 13:02:55 +02:00
|
|
|
upload_size = len(upload_contents)
|
|
|
|
upload_size_encoded = [
|
|
|
|
(upload_size >> 24) & 0xFF,
|
|
|
|
(upload_size >> 16) & 0xFF,
|
|
|
|
(upload_size >> 8) & 0xFF,
|
|
|
|
(upload_size >> 0) & 0xFF,
|
2018-10-14 19:14:28 +02:00
|
|
|
]
|
2021-10-22 13:02:55 +02:00
|
|
|
send_check(sock, upload_size_encoded, "binary size")
|
2021-03-07 20:03:16 +01:00
|
|
|
receive_exactly(sock, 1, "binary size", RESPONSE_UPDATE_PREPARE_OK)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2021-10-22 13:02:55 +02:00
|
|
|
upload_md5 = hashlib.md5(upload_contents).hexdigest()
|
|
|
|
_LOGGER.debug("MD5 of upload is %s", upload_md5)
|
|
|
|
|
|
|
|
send_check(sock, upload_md5, "file checksum")
|
2021-03-07 20:03:16 +01:00
|
|
|
receive_exactly(sock, 1, "file checksum", RESPONSE_BIN_MD5_OK)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2018-11-13 15:31:14 +01:00
|
|
|
# Disable nodelay for transfer
|
|
|
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 0)
|
|
|
|
# Limit send buffer (usually around 100kB) in order to have progress bar
|
|
|
|
# show the actual progress
|
2023-11-15 05:14:37 +01:00
|
|
|
|
|
|
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, UPLOAD_BUFFER_SIZE)
|
2019-04-22 21:56:30 +02:00
|
|
|
# Set higher timeout during upload
|
2023-11-15 05:14:37 +01:00
|
|
|
sock.settimeout(30.0)
|
|
|
|
start_time = time.perf_counter()
|
2018-11-13 15:31:14 +01:00
|
|
|
|
2018-10-14 19:14:28 +02:00
|
|
|
offset = 0
|
2018-12-05 21:22:06 +01:00
|
|
|
progress = ProgressBar()
|
2018-10-14 19:14:28 +02:00
|
|
|
while True:
|
2023-11-15 05:14:37 +01:00
|
|
|
chunk = upload_contents[offset : offset + UPLOAD_BLOCK_SIZE]
|
2018-10-14 19:14:28 +02:00
|
|
|
if not chunk:
|
|
|
|
break
|
|
|
|
offset += len(chunk)
|
|
|
|
|
|
|
|
try:
|
|
|
|
sock.sendall(chunk)
|
2024-01-19 05:18:06 +01:00
|
|
|
if version >= OTA_VERSION_2_0:
|
|
|
|
receive_exactly(sock, 1, "chunk OK", RESPONSE_CHUNK_OK)
|
2019-12-07 18:28:55 +01:00
|
|
|
except OSError as err:
|
2021-03-07 20:03:16 +01:00
|
|
|
sys.stderr.write("\n")
|
2020-09-16 12:12:40 +02:00
|
|
|
raise OTAError(f"Error sending data: {err}") from err
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2021-10-22 13:02:55 +02:00
|
|
|
progress.update(offset / upload_size)
|
2018-12-05 21:22:06 +01:00
|
|
|
progress.done()
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2018-11-13 15:31:14 +01:00
|
|
|
# Enable nodelay for last checks
|
|
|
|
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
|
2023-11-15 05:14:37 +01:00
|
|
|
duration = time.perf_counter() - start_time
|
2018-11-13 15:31:14 +01:00
|
|
|
|
2023-11-15 05:14:37 +01:00
|
|
|
_LOGGER.info("Upload took %.2f seconds, waiting for result...", duration)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2021-03-07 20:03:16 +01:00
|
|
|
receive_exactly(sock, 1, "receive OK", RESPONSE_RECEIVE_OK)
|
|
|
|
receive_exactly(sock, 1, "Update end", RESPONSE_UPDATE_END_OK)
|
|
|
|
send_check(sock, RESPONSE_OK, "end acknowledgement")
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
_LOGGER.info("OTA successful")
|
|
|
|
|
2018-12-18 19:31:43 +01:00
|
|
|
# Do not connect logs until it is fully on
|
2018-12-24 14:15:24 +01:00
|
|
|
time.sleep(1)
|
2018-10-14 19:14:28 +02:00
|
|
|
|
2018-11-07 22:41:54 +01:00
|
|
|
|
2018-12-18 19:31:43 +01:00
|
|
|
def run_ota_impl_(remote_host, remote_port, password, filename):
|
|
|
|
if is_ip_address(remote_host):
|
|
|
|
_LOGGER.info("Connecting to %s", remote_host)
|
|
|
|
ip = remote_host
|
2018-11-07 22:41:54 +01:00
|
|
|
else:
|
2018-12-18 19:31:43 +01:00
|
|
|
_LOGGER.info("Resolving IP address of %s", remote_host)
|
|
|
|
try:
|
|
|
|
ip = resolve_ip_address(remote_host)
|
2019-02-13 16:54:02 +01:00
|
|
|
except EsphomeError as err:
|
2021-03-07 20:03:16 +01:00
|
|
|
_LOGGER.error(
|
|
|
|
"Error resolving IP address of %s. Is it connected to WiFi?",
|
|
|
|
remote_host,
|
|
|
|
)
|
|
|
|
_LOGGER.error(
|
|
|
|
"(If this error persists, please set a static IP address: "
|
|
|
|
"https://esphome.io/components/wifi.html#manual-ips)"
|
|
|
|
)
|
2020-09-16 12:12:40 +02:00
|
|
|
raise OTAError(err) from err
|
2018-12-18 19:31:43 +01:00
|
|
|
_LOGGER.info(" -> %s", ip)
|
2018-11-07 22:41:54 +01:00
|
|
|
|
2018-10-14 19:14:28 +02:00
|
|
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
2018-11-07 22:41:54 +01:00
|
|
|
sock.settimeout(10.0)
|
2018-10-14 19:14:28 +02:00
|
|
|
try:
|
2018-11-07 22:41:54 +01:00
|
|
|
sock.connect((ip, remote_port))
|
2019-12-07 18:28:55 +01:00
|
|
|
except OSError as err:
|
2018-10-14 19:14:28 +02:00
|
|
|
sock.close()
|
|
|
|
_LOGGER.error("Connecting to %s:%s failed: %s", remote_host, remote_port, err)
|
|
|
|
return 1
|
|
|
|
|
2021-05-10 22:57:25 +02:00
|
|
|
with open(filename, "rb") as file_handle:
|
|
|
|
try:
|
|
|
|
perform_ota(sock, password, file_handle, filename)
|
|
|
|
except OTAError as err:
|
|
|
|
_LOGGER.error(str(err))
|
|
|
|
return 1
|
|
|
|
finally:
|
|
|
|
sock.close()
|
2018-10-14 19:14:28 +02:00
|
|
|
|
|
|
|
return 0
|
|
|
|
|
|
|
|
|
2018-12-05 21:22:06 +01:00
|
|
|
def run_ota(remote_host, remote_port, password, filename):
|
|
|
|
try:
|
|
|
|
return run_ota_impl_(remote_host, remote_port, password, filename)
|
|
|
|
except OTAError as err:
|
|
|
|
_LOGGER.error(err)
|
2019-06-07 14:26:28 +02:00
|
|
|
return 1
|