From 9efbcce0e4762112dc634d4d6e0a3d337db2e8f1 Mon Sep 17 00:00:00 2001 From: rospogrigio Date: Sun, 8 Jan 2023 07:42:53 +0100 Subject: [PATCH] Fixed requested DPs for type_0d devices --- custom_components/localtuya/pytuya/__init__.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/custom_components/localtuya/pytuya/__init__.py b/custom_components/localtuya/pytuya/__init__.py index 1241e02..32dc744 100644 --- a/custom_components/localtuya/pytuya/__init__.py +++ b/custom_components/localtuya/pytuya/__init__.py @@ -704,7 +704,7 @@ class TuyaProtocol(asyncio.Protocol, ContextualLogger): return None # 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 # to a CONTROL_NEW command, consider it an ACK 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) if "data unvalid" in payload: self.dev_type = "type_0d" - # set at least one DPS - self.dps_to_request = {"1": None} self.debug( "'data unvalid' error detected: switching to dev_type %r", self.dev_type,