Fixed requested DPs for type_0d devices

This commit is contained in:
rospogrigio
2023-01-08 07:42:53 +01:00
committed by rospogrigio
parent a3914cc8ce
commit 960f07b6bb

View File

@@ -704,7 +704,7 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
return None return None
# TODO: Verify stuff, e.g. CRC sequence number? # TODO: Verify stuff, e.g. CRC sequence number?
if real_cmd == CONTROL_NEW and len(msg.payload) == 0: if real_cmd in [HEART_BEAT, CONTROL_NEW] and len(msg.payload) == 0:
# device may send one or two messages with empty payload in response # device may send one or two messages with empty payload in response
# to a CONTROL_NEW command, consider it an ACK # to a CONTROL_NEW command, consider it an ACK
self.debug("ACK received for command %d: ignoring it", real_cmd) self.debug("ACK received for command %d: ignoring it", real_cmd)
@@ -860,8 +860,6 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger):
return self.error_json(ERR_JSON, payload) return self.error_json(ERR_JSON, payload)
if "data unvalid" in payload: if "data unvalid" in payload:
self.dev_type = "type_0d" self.dev_type = "type_0d"
# set at least one DPS
self.dps_to_request = {"1": None}
self.debug( self.debug(
"'data unvalid' error detected: switching to dev_type %r", "'data unvalid' error detected: switching to dev_type %r",
self.dev_type, self.dev_type,