diff --git a/Classes/ZigpyTransport/AppGeneric.py b/Classes/ZigpyTransport/AppGeneric.py index 6674a871b..12cee00f2 100644 --- a/Classes/ZigpyTransport/AppGeneric.py +++ b/Classes/ZigpyTransport/AppGeneric.py @@ -123,7 +123,7 @@ def handle_join(self, nwk: t.NWK, ieee: t.EUI64, parent_nwk: t.NWK) -> None: """ Called when a device joins or announces itself on the network. """ - self.log.logging("TransportZigpy", "Log","handle_join (0x%04x %s)" %(nwk, ieee)) + self.log.logging("TransportZigpy", "Debug","handle_join (0x%04x %s)" %(nwk, ieee)) if str(ieee) in {"00:00:00:00:00:00:00:00", "ff:ff:ff:ff:ff:ff:ff:ff"}: # invalid ieee, drop @@ -176,22 +176,20 @@ def packet_received( """Notify zigpy of a received Zigbee packet.""" self.log.logging("TransportZigpy", "Debug", "packet_received %s" %(packet)) - - sender , addr_mode, profile, cluster, src_ep, dst_ep = ( - packet.src.address.serialize()[::-1].hex(), - int(packet.src.addr_mode), - int(packet.profile_id), - int(packet.cluster_id), - int(packet.src_ep), - int(packet.dst_ep) - ) - #self.log.logging("TransportZigpy", "Debug", " Src : %s (%s)" %(sender,type(sender))) - #self.log.logging("TransportZigpy", "Debug", " AddrMod : %02X" %(addr_mode)) - #self.log.logging("TransportZigpy", "Debug", " src Ep : %02X" %(dst_ep)) - #self.log.logging("TransportZigpy", "Debug", " dst Ep : %02x" %(dst_ep)) - #self.log.logging("TransportZigpy", "Debug", " Profile : %04X" %(profile)) - #self.log.logging("TransportZigpy", "Debug", " Cluster : %04X" %(cluster)) + sender = packet.src.address.serialize()[::-1].hex() + addr_mode = int(packet.src.addr_mode) if packet.src.addr_mode is not None else None + profile = int(packet.profile_id) if packet.profile_id is not None else None + cluster = int(packet.cluster_id) if packet.cluster_id is not None else None + src_ep = int(packet.src_ep) if packet.src_ep is not None else None + dst_ep = int(packet.dst_ep) if packet.dst_ep is not None else None + + # self.log.logging("TransportZigpy", "Log", " Src : %s (%s)" %(sender,type(sender))) + # self.log.logging("TransportZigpy", "Log", " AddrMod : %02X" %(addr_mode)) + # self.log.logging("TransportZigpy", "Log", " src Ep : %02X" %(dst_ep)) + # self.log.logging("TransportZigpy", "Log", " dst Ep : %02x" %(dst_ep)) + # self.log.logging("TransportZigpy", "Log", " Profile : %04X" %(profile)) + # self.log.logging("TransportZigpy", "Log", " Cluster : %04X" %(cluster)) message = packet.data.serialize() hex_message = binascii.hexlify(message).decode("utf-8") @@ -203,7 +201,10 @@ def packet_received( hex_message = binascii.hexlify(message).decode("utf-8") write_capture_rx_frames( self, packet.src, profile, cluster, src_ep, dst_ep, message, hex_message, dst_addressing) - if packet.src == 0x0000 or ( zigpy.zdo.ZDO_ENDPOINT in (packet.src_ep, packet.dst_ep)): + if sender is None or profile is None or cluster is None: + super(type(self),self).packet_received(packet) + + if sender == 0x0000 or ( zigpy.zdo.ZDO_ENDPOINT in (packet.src_ep, packet.dst_ep)): self.log.logging("TransportZigpy", "Debug", "handle_message from Controller Sender: %s Profile: %04x Cluster: %04x srcEp: %02x dstEp: %02x message: %s" %( sender, profile, cluster, src_ep, dst_ep, hex_message)) super(type(self),self).packet_received(packet) diff --git a/Modules/pairingProcess.py b/Modules/pairingProcess.py index 3ba8f5bbc..5de8b4c07 100644 --- a/Modules/pairingProcess.py +++ b/Modules/pairingProcess.py @@ -210,19 +210,13 @@ def interview_state_8043(self, NWKID, RIA, knownModel, status): def request_node_descriptor(self, NWKID, RIA=None, status=None): + """ Trigger a Req Node Descriptor if Manufacturer not found""" - if "Manufacturer" in self.ListOfDevices[NWKID]: - if self.ListOfDevices[NWKID]["Manufacturer"] in ({}, ""): - self.log.logging("Pairing", "Status", "[%s] NEW OBJECT: %s Request Node Descriptor" % (RIA, NWKID)) - zdp_node_descriptor_request(self, NWKID) - return True - - self.log.logging( - "Pairing", - "Debug", - "[%s] NEW OBJECT: %s Manufacturer: %s" % (RIA, NWKID, self.ListOfDevices[NWKID]["Manufacturer"]), - NWKID, - ) + manufacturer = self.ListOfDevices[NWKID].get("Manufacturer", "") + model = self.ListOfDevices[NWKID].get("Model", "") + + if model in ( "lumi.sensor_switch",) or manufacturer not in ( "", {} ): + self.log.logging( "Pairing", "Debug", "[%s] NEW OBJECT: %s Manufacturer: %s Model: %s" % (RIA, NWKID, manufacturer, model), NWKID, ) return False self.log.logging("Pairing", "Status", "[%s] NEW OBJECT: %s Request Node Descriptor" % (RIA, NWKID)) diff --git a/Modules/readClusters.py b/Modules/readClusters.py index af512a893..310a27083 100644 --- a/Modules/readClusters.py +++ b/Modules/readClusters.py @@ -787,7 +787,7 @@ def Cluster0012(self, Devices, MsgSQN, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgAt checkAndStoreAttributeValue(self, MsgSrcAddr, MsgSrcEp, MsgClusterId, MsgAttrID, value) checkAndStoreAttributeValue(self, MsgSrcAddr, MsgSrcEp, "0006", "0000", value) - elif _modelName in ("lumi.sensor_switch.aq3", "lumi.sensor_switch.aq3"): + elif _modelName in ("lumi.sensor_switch.aq3", "lumi.sensor_switch.aq3t"): value = int(decodeAttribute(self, MsgAttType, MsgClusterData)) self.log.logging( "Cluster",