Hello to all,
I'm working on a project based on sending data collected from a sensor network to a Zigbee Coordinator: the sensors are End Devices and must be tied to a Coordinator to make this save the data recorded by the sensors. The example I'm basing myself on is that of multi-sensor.
But I don't want to use the command line interface but I want to build a Coordinator that presents a "temperature Measurement" client-side cluster and that can bind with the single sensor and then enable reporting of the MeasuredValue attribute.
My problem is that the binding between the Coordinator and the sensor does not happen: I briefly explain what I do.
The Coordinator and the sensor are connected to the same network; after that, the Coordinator sends the request for Match Descriptor and I find the short address and the endpoint of the sensor. After that I make an Extended Address request and get the device address. I already have both the eee address and the coordinator endpoint. At this point the Bind request starts: after sending the request, I see that the associated callback is never called. Am I wrong in interpreting the data? The struct zb_zdo_bind_req_param_t is filled like this: everything that is part of the destination is filled with sensor data, while everything concerning the source is filled with the data of the Coordinator. Am I doing something wrong? I'm sending the bind_req from the Coordinator firmware and not from the sensor. I also attach the part of the code written by me.
typedef struct attr_query_s { zb_ieee_addr_t remote_ieee_addr; zb_ieee_addr_t src_ieee_addr; zb_addr_u remote_node; zb_uint8_t remote_addr_mode; zb_uint8_t remote_ep; zb_uint16_t profile_id; zb_uint16_t cluster_id; zb_uint8_t dst_endpoint; zb_uint8_t attr_type; zb_uint8_t attr_value[32]; zb_zcl_frame_direction_t direction; } attr_query_t; static attr_query_t m_attr_table[ATTRIBUTE_TABLE_SIZE]; static zb_void_t bind_device(zb_uint8_t param) { zb_zdo_bind_req_param_t * p_req; zb_buf_t * p_buf= ZB_BUF_FROM_REF(param); zb_ret_t zb_err_code; ZB_BUF_INITIAL_ALLOC(p_buf, sizeof(zb_zdo_bind_req_param_t), p_req); ZB_LETOH64(p_req->dst_address.addr_long,m_attr_table[item].src_ieee_addr); //ieee address of coordinator p_req->src_endp = m_attr_table[item].remote_ep; //endpoint of sensor p_req->cluster_id = ZB_ZCL_CLUSTER_ID_TEMP_MEASUREMENT; p_req->dst_addr_mode = ZB_BIND_DST_ADDR_MODE_64_BIT_EXTENDED; //ieee address mode of coordinator ZB_LETOH64(p_req->src_address,m_attr_table[item].remote_ieee_addr); //ieee address of sensor p_req->dst_endp = HA_TEMP_SENSOR_ENDPOINT; //endpoint of coordinator p_req->req_dst_addr = m_attr_table[item].remote_node.addr_short; //short address of sensor UNUSED_RETURN_VALUE(zb_zdo_bind_req(param, bind_device_cb)); }
Best regards,
Raffaela