mirror of
https://github.com/esphome/esphome.git
synced 2025-03-15 15:18:16 +00:00
Lint
This commit is contained in:
parent
f6ae1b31a8
commit
afc81df682
@ -223,9 +223,10 @@ def upload_program(config, args, port):
|
|||||||
password = ota.get_auth(config)
|
password = ota.get_auth(config)
|
||||||
|
|
||||||
res = espota2.run_ota(host, remote_port, password, bin_file)
|
res = espota2.run_ota(host, remote_port, password, bin_file)
|
||||||
if res != 0:
|
if res == 0:
|
||||||
_LOGGER.warn("OTA v2 method failed. Trying with legacy OTA...")
|
return res
|
||||||
espota2.run_legacy_ota(verbose, host_port, host, remote_port, password, bin_file)
|
_LOGGER.warn("OTA v2 method failed. Trying with legacy OTA...")
|
||||||
|
return espota2.run_legacy_ota(verbose, host_port, host, remote_port, password, bin_file)
|
||||||
|
|
||||||
|
|
||||||
def show_logs(config, args, port, escape=False):
|
def show_logs(config, args, port, escape=False):
|
||||||
|
@ -138,9 +138,9 @@ def perform_ota(sock, password, file_handle, filename):
|
|||||||
if not password:
|
if not password:
|
||||||
raise OTAError("ESP requests password, but no password given!")
|
raise OTAError("ESP requests password, but no password given!")
|
||||||
nonce = receive_exactly(sock, 32, 'authentication nonce', [], decode=False)
|
nonce = receive_exactly(sock, 32, 'authentication nonce', [], decode=False)
|
||||||
_LOGGER.debug("Auth: Nonce is {}".format(nonce))
|
_LOGGER.debug("Auth: Nonce is %s", nonce)
|
||||||
cnonce = hashlib.md5(str(random.random()).encode()).hexdigest()
|
cnonce = hashlib.md5(str(random.random()).encode()).hexdigest()
|
||||||
_LOGGER.debug("Auth: CNonce is {}".format(cnonce))
|
_LOGGER.debug("Auth: CNonce is %s", cnonce)
|
||||||
|
|
||||||
send_check(sock, cnonce, 'auth cnonce')
|
send_check(sock, cnonce, 'auth cnonce')
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ def perform_ota(sock, password, file_handle, filename):
|
|||||||
result_md5.update(nonce.encode())
|
result_md5.update(nonce.encode())
|
||||||
result_md5.update(cnonce.encode())
|
result_md5.update(cnonce.encode())
|
||||||
result = result_md5.hexdigest()
|
result = result_md5.hexdigest()
|
||||||
_LOGGER.debug("Auth: Result is {}".format(result))
|
_LOGGER.debug("Auth: Result is %s", result)
|
||||||
|
|
||||||
send_check(sock, result, 'auth result')
|
send_check(sock, result, 'auth result')
|
||||||
receive_exactly(sock, 1, 'auth result', RESPONSE_AUTH_OK)
|
receive_exactly(sock, 1, 'auth result', RESPONSE_AUTH_OK)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user