Fixed tox errors
This commit is contained in:
@@ -566,7 +566,7 @@ class LocalTuyaOptionsFlowHandler(config_entries.OptionsFlow):
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
return await self.async_step_pick_entity_type()
|
return await self.async_step_pick_entity_type()
|
||||||
else:
|
|
||||||
self.device_data.update(
|
self.device_data.update(
|
||||||
{
|
{
|
||||||
CONF_DEVICE_ID: dev_id,
|
CONF_DEVICE_ID: dev_id,
|
||||||
|
@@ -769,7 +769,7 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
|
|||||||
try:
|
try:
|
||||||
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
|
msg = await self.dispatcher.wait_for(seqno, payload.cmd)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.debug("Wait was aborted for seqno %d", seqno)
|
self.debug("Wait was aborted for seqno %d (%s)", seqno, ex)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# TODO: Verify stuff, e.g. CRC sequence number?
|
# TODO: Verify stuff, e.g. CRC sequence number?
|
||||||
@@ -889,7 +889,9 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
|
|||||||
# self.debug("decrypting=%r", payload)
|
# self.debug("decrypting=%r", payload)
|
||||||
payload = cipher.decrypt(payload, False, decode_text=False)
|
payload = cipher.decrypt(payload, False, decode_text=False)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.debug("incomplete payload=%r (len:%d)", payload, len(payload))
|
self.debug(
|
||||||
|
"incomplete payload=%r with len:%d (%s)", payload, len(payload), ex
|
||||||
|
)
|
||||||
return self.error_json(ERR_PAYLOAD)
|
return self.error_json(ERR_PAYLOAD)
|
||||||
|
|
||||||
# self.debug("decrypted 3.x payload=%r", payload)
|
# self.debug("decrypted 3.x payload=%r", payload)
|
||||||
@@ -915,7 +917,12 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
|
|||||||
# self.debug("decrypting=%r", payload)
|
# self.debug("decrypting=%r", payload)
|
||||||
payload = cipher.decrypt(payload, False)
|
payload = cipher.decrypt(payload, False)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.debug("incomplete payload=%r (len:%d)", payload, len(payload))
|
self.debug(
|
||||||
|
"incomplete payload=%r with len:%d (%s)",
|
||||||
|
payload,
|
||||||
|
len(payload),
|
||||||
|
ex,
|
||||||
|
)
|
||||||
return self.error_json(ERR_PAYLOAD)
|
return self.error_json(ERR_PAYLOAD)
|
||||||
|
|
||||||
# self.debug("decrypted 3.x payload=%r", payload)
|
# self.debug("decrypted 3.x payload=%r", payload)
|
||||||
@@ -946,7 +953,9 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
|
|||||||
try:
|
try:
|
||||||
json_payload = json.loads(payload)
|
json_payload = json.loads(payload)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
raise DecodeError("could not decrypt data: wrong local_key?")
|
raise DecodeError(
|
||||||
|
"could not decrypt data: wrong local_key? (exception %s)", ex
|
||||||
|
)
|
||||||
# json_payload = self.error_json(ERR_JSON, payload)
|
# json_payload = self.error_json(ERR_JSON, payload)
|
||||||
|
|
||||||
# v3.4 stuffs it into {"data":{"dps":{"1":true}}, ...}
|
# v3.4 stuffs it into {"data":{"dps":{"1":true}}, ...}
|
||||||
@@ -983,9 +992,10 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
|
|||||||
payload = cipher.decrypt(payload, False, decode_text=False)
|
payload = cipher.decrypt(payload, False, decode_text=False)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
self.debug(
|
self.debug(
|
||||||
"session key step 2 decrypt failed, payload=%r (len:%d)",
|
"session key step 2 decrypt failed, payload=%r with len:%d (%s)",
|
||||||
payload,
|
payload,
|
||||||
len(payload),
|
len(payload),
|
||||||
|
ex,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user