Skip to content

Commit

Permalink
Fix: ZigBee 3.4 devices updates affect other nodes on same GW
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Oct 11, 2023
1 parent 0e22c6d commit 1e6889b
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions custom_components/localtuya/core/pytuya/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,21 +815,12 @@ def _setup_dispatcher(self, enable_debug):
def _status_update(msg):
if msg.seqno > 0:
self.seqno = msg.seqno + 1
decoded_message = self._decode_payload(msg.payload)
if "data" in decoded_message and "dps" in decoded_message:
decoded_message.pop("data")
if "dps" in decoded_message:
if "cid" in decoded_message and decoded_message["cid"] != self.node_id:
return
self.dps_cache.update(decoded_message["dps"])
# Special case for >= 3.4 devices.
elif "data" in decoded_message:
if (
"cid" in decoded_message["data"]
and decoded_message["data"]["cid"] != self.node_id
):
return
decoded_message: dict = self._decode_payload(msg.payload)

if "cid" in decoded_message and decoded_message["cid"] != self.node_id:
return

if "dps" in decoded_message:
self.dps_cache.update(decoded_message["dps"])

listener = self.listener and self.listener()
Expand Down Expand Up @@ -1189,6 +1180,9 @@ def _decode_payload(self, payload):
):
json_payload["dps"] = json_payload["data"]["dps"]

if "cid" in json_payload["data"]:
json_payload["cid"] = json_payload["data"]["cid"]

# We will store the payload to trigger an event in HA.
if "dps" in json_payload:
self.dispatched_dps = json_payload["dps"]
Expand Down

0 comments on commit 1e6889b

Please sign in to comment.