def handle_message(self, profile, cluster, src_ep, dst_ep, message): self.last_seen = time.time() try: hdr, args = self.deserialize(src_ep, cluster, message) except ValueError as e: LOGGER.error( "Failed to parse message (%s) on cluster %d, because %s", binascii.hexlify(message), cluster, e, ) return except KeyError as e: LOGGER.debug( ("Ignoring message (%s) on cluster %d: " "unknown endpoint or cluster id: %s"), binascii.hexlify(message), cluster, e, ) return if hdr.tsn in self._pending and hdr.is_reply: try: self._pending[hdr.tsn].result.set_result(args) return except asyncio.InvalidStateError: self.debug( ("Invalid state on future for 0x%02x seq " "-- probably duplicate response"), hdr.tsn, ) return endpoint = self.endpoints[src_ep] return endpoint.handle_message(profile, cluster, hdr, args)
def handle_message(self, is_reply, profile, cluster, src_ep, dst_ep, tsn, command_id, args): try: endpoint = self.endpoints[dst_ep] except KeyError: self.warn( "Message on unknown endpoint %s", dst_ep, ) return return endpoint.handle_message(is_reply, profile, cluster, tsn, command_id, args)
def handle_message(self, is_reply, profile, cluster, src_ep, dst_ep, tsn, command_id, args): self.last_seen = time.time() if not self.node_desc.is_valid and (self._node_handle is None or self._node_handle.done()): self._node_handle = asyncio.ensure_future( self.refresh_node_descriptor()) try: endpoint = self.endpoints[src_ep] except KeyError: self.warn("Message on unknown endpoint %s", src_ep) return return endpoint.handle_message(is_reply, profile, cluster, tsn, command_id, args)
def handle_message(self, profile, cluster, src_ep, dst_ep, message): self.last_seen = time.time() if not self.node_desc.is_valid and ( self._node_handle is None or self._node_handle.done() ): self._node_handle = asyncio.ensure_future(self.refresh_node_descriptor()) try: tsn, command_id, is_reply, args = self.deserialize(src_ep, cluster, message) except ValueError as e: LOGGER.error( "Failed to parse message (%s) on cluster %d, because %s", binascii.hexlify(message), cluster, e, ) return except KeyError as e: LOGGER.debug( ( "Ignoring message (%s) on cluster %d: " "unknown endpoint or cluster id: %s" ), binascii.hexlify(message), cluster, e, ) return if tsn in self._pending and is_reply: try: self._pending[tsn].result.set_result(args) return except asyncio.InvalidStateError: self.debug( ( "Invalid state on future for 0x%02x seq " "-- probably duplicate response" ), tsn, ) return endpoint = self.endpoints[src_ep] return endpoint.handle_message(profile, cluster, tsn, command_id, args)