I got a TIME_OUT response by command API of 'GW_SET_ATTRIBUTE_REPORTING_RSP_IND' while trying to send the commond API of 'GW_SET_ATTRIBUTE_REPORTING_REQ'. The params and the ieeeAddress seemed completely correct.
Anyone could help on this? Or, if any other way to pass customized data between the gateway and the device? BTW, the generic response command DEV_SET_ONOFF_STATE_REQ works fine for simple on/off actions.
My code as follow:
# coding=utf-8 import socket import gateway_pb2 import struct # device = gateway_pb2.GwSetAttributeReportingReq() device.cmdId = 20 device.dstAddress.addressType = 0 device.dstAddress.ieeeAddr = 0x00124B0005XXXXXX device.dstAddress.endpointId = 8 device.clusterId = 0x0201 attr1 = device.attributeReportList.add() attr1.attributeId = 0x0008 attr1.attributeType = 0x20 attr1.minReportInterval = 1 attr1.maxReportInterval = 10 attr1.reportableChange = 0 attr2 = device.attributeReportList.add() attr2.attributeId = 0x0007 attr2.attributeType = 0x20 attr2.minReportInterval = 1 attr2.maxReportInterval = 10 attr2.reportableChange = 0 packed_google_str = device.SerializeToString() pkg_len = len(packed_google_str) sys_id = 19 cmd_id = device.cmdId header_pkg_len = struct.pack('H', pkg_len) header_sys_id = struct.pack('B', sys_id) header_cmd_id = struct.pack('B', cmd_id) packed_pkg = header_pkg_len + header_sys_id + header_cmd_id + packed_google_str HOST = '192.168.1.55' PORT = 2541 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connect((HOST,PORT)) s.send(packed_pkg)