工具/软件:
我正在构建一个 3 组智能开关、这意味着它控制三 个不同的输出、我假设使用 ON_OFF_OUTPUT 集群控制不同的 3 个输出、然后我将具有 3 个不同的端点、每个输出一个。 但是根据 ZBOSS 文档、我最多可以做 1 个端点、如何处理此类问题或者是否有任何其他解决方法?
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
尊敬的 Abdelrahman:
可以使用多个端点、下面是我对 onoff_light 进行的一些更改/添加:
#define ZB_LOCK_ENDPOINT 11 //... ZB_HA_DECLARE_DOOR_LOCK_CONTROLLER_CLUSTER_LIST(door_lock_controller_clusters, basic_attr_list, identify_attr_list); ZB_HA_DECLARE_DOOR_LOCK_CONTROLLER_EP(door_lock_controller_ep, ZB_LOCK_ENDPOINT, door_lock_controller_clusters); /* Declare application's device context for single-endpoint device */ //ZB_HA_DECLARE_ON_OFF_OUTPUT_CTX(on_off_output_ctx, on_off_output_ep); //MAKE SURE TO REPLACE THIS ZBOSS_DECLARE_DEVICE_CTX_2_EP(on_off_output_ctx, on_off_output_ep, door_lock_controller_ep); //... ZB_AF_SET_ENDPOINT_HANDLER(ZB_LOCK_ENDPOINT, zcl_specific_cluster_cmd_handler);
当然、您应该改用 ZBOSS_DECLATE_DEVICE_CTX_3_EP 、并修改应用程序回调以确定命令用于哪个端点。
此致、
Ryan
好的、我明白了。 但我在为同一 ON_OFF_OUTPUT 集群定义 3 个终点时遇到了问题。 问题是 3 ZB_af_simple_desc_5 在定义 3 个端点时多次声明、因为它在 zboss_api_af.h 中的定义如下:
typedef ZB_PACKED_PRE struct zb_af_simple_desc_ ## in_clusters_count ## _ ## out_clusters_count ## _s \ { \ zb_uint8_t endpoint; /* Endpoint */ \ zb_uint16_t app_profile_id; /* Application profile identifier */ \ zb_uint16_t app_device_id; /* Application device identifier */ \ zb_bitfield_t app_device_version:4; /* Application device version */ \ zb_bitfield_t reserved:4; /* Reserved */ \ zb_uint8_t app_input_cluster_count; /* Application input cluster count */ \ zb_uint8_t app_output_cluster_count; /* Application output cluster count */ \ /* Application input and output cluster list */ \ zb_uint16_t app_cluster_list[(in_clusters_count) + (out_clusters_count)]; \ zb_uint8_t cluster_encryption[((in_clusters_count) + (out_clusters_count) + 7)/8]; \ } ZB_PACKED_STRUCT
ON_OFF_OUTPUT 集群的 in_clusters_COUNT 和 OUT_clusters_COUNT 分别为 5 和 0。 这使我得到错误 ZB_af_simple_desc_5 被多次定义
这是用于声明集群的代码
/***** Trace related defines *****/ #define ZB_TRACE_FILE_ID 40124 /****** Application defines ******/ #define ZB_SWITCH1_ENDPOINT 1 #define ZB_SWITCH2_ENDPOINT 2 #define ZB_SWITCH3_ENDPOINT 3 #include <ti/log/Log.h> #include "ti_zigbee_config.h" #include "zboss_api.h" #include "zb_led_button.h" #include "zboss_api_error.h" #include <ti/devices/DeviceFamily.h> #include DeviceFamily_constructPath(inc/hw_fcfg.h) #include DeviceFamily_constructPath(inc/hw_memmap.h) /* for button handling */ #include <ti/drivers/GPIO.h> #include "ti_drivers_config.h" #ifdef ZB_CONFIGURABLE_MEM #include "zb_mem_config_lprf3.h" #endif #if !defined ZB_ED_FUNC #error define ZB_ED_ROLE to compile the tests #endif // TODO: adjust transmit power /****** Application variables declarations ******/ /* IEEE address of the device */ zb_bool_t cmd_in_progress = ZB_FALSE; zb_bool_t perform_factory_reset = ZB_FALSE; zb_uint16_t g_dst_addr; zb_uint8_t g_addr_mode; zb_uint8_t g_endpoint; /****** Application function declarations ******/ zb_uint8_t zcl_specific_cluster_cmd_handler(zb_uint8_t param); void on_off_read_attr_resp_handler(zb_bufid_t cmd_buf); void send_toggle_req(zb_uint8_t param); void button_press_handler(zb_uint8_t param); /****** Cluster declarations ******/ // on-off attributes for the light switch zb_bool_t g_attr_on_off1 = ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE; zb_bool_t g_attr_on_off2 = ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE; zb_bool_t g_attr_on_off3 = ZB_ZCL_ON_OFF_ON_OFF_DEFAULT_VALUE; ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(on_off_attr_list1, &g_attr_on_off1); ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(on_off_attr_list2, &g_attr_on_off2); ZB_ZCL_DECLARE_ON_OFF_ATTRIB_LIST(on_off_attr_list3, &g_attr_on_off3); /* Basic cluster attributes */ zb_uint8_t attr_power_source = ZB_ZCL_BASIC_POWER_SOURCE_MAINS_SINGLE_PHASE; zb_uint8_t attr_zcl_version = 0x03; zb_uint8_t attr_app_version = 0x40; zb_uint8_t attr_stack_version = 0x02; zb_uint8_t attr_hardware_version = 0x01; zb_uint8_t attr_application_version = 0x40; zb_uint16_t attr_cluster_rev = 0x0001; zb_uint8_t attr_manufacturer_name[16]; zb_uint8_t attr_model_id[16]; zb_uint8_t attr_data_code = ZB_ZCL_BASIC_MODEL_IDENTIFIER_DEFAULT_VALUE; zb_uint8_t attr_location_id = ZB_ZCL_BASIC_LOCATION_DESCRIPTION_DEFAULT_VALUE; zb_uint8_t attr_ph_env = ZB_ZCL_BASIC_PHYSICAL_ENVIRONMENT_DEFAULT_VALUE; zb_uint8_t attr_sw_build_id[] = ZB_ZCL_BASIC_SW_BUILD_ID_DEFAULT_VALUE; ZB_ZCL_DECLARE_BASIC_ATTRIB_LIST_EXT(basic_attr_list, &attr_zcl_version, &attr_app_version, &attr_stack_version, &attr_hardware_version, &attr_manufacturer_name, &attr_model_id, &attr_data_code, &attr_power_source, &attr_location_id, &attr_ph_env, &attr_sw_build_id); /* Identify cluster attributes */ zb_uint16_t attr_identify_time = 0; ZB_ZCL_DECLARE_IDENTIFY_ATTRIB_LIST(identify_attr_list, &attr_identify_time); /* Declare cluster list for the device */ zb_uint8_t g_attr_scenes_scene_count = ZB_ZCL_SCENES_SCENE_COUNT_DEFAULT_VALUE; zb_uint8_t g_attr_scenes_current_scene = ZB_ZCL_SCENES_CURRENT_SCENE_DEFAULT_VALUE; zb_uint16_t g_attr_scenes_current_group = ZB_ZCL_SCENES_CURRENT_GROUP_DEFAULT_VALUE; zb_uint8_t g_attr_scenes_scene_valid = ZB_ZCL_SCENES_SCENE_VALID_DEFAULT_VALUE; zb_uint16_t g_attr_scenes_name_support = ZB_ZCL_SCENES_NAME_SUPPORT_DEFAULT_VALUE; ZB_ZCL_DECLARE_SCENES_ATTRIB_LIST(scenes_attr_list, &g_attr_scenes_scene_count, &g_attr_scenes_current_scene, &g_attr_scenes_current_group, &g_attr_scenes_scene_valid, &g_attr_scenes_name_support); zb_uint8_t g_attr_name_support = 0; ZB_ZCL_DECLARE_GROUPS_ATTRIB_LIST(groups_attr_list, &g_attr_name_support); ZB_HA_DECLARE_ON_OFF_OUTPUT_CLUSTER_LIST(on_off_output_clusters1, on_off_attr_list1, basic_attr_list, identify_attr_list, groups_attr_list, scenes_attr_list); ZB_HA_DECLARE_ON_OFF_OUTPUT_CLUSTER_LIST(on_off_output_clusters2, on_off_attr_list2, basic_attr_list, identify_attr_list, groups_attr_list, scenes_attr_list); ZB_HA_DECLARE_ON_OFF_OUTPUT_CLUSTER_LIST(on_off_output_clusters3, on_off_attr_list3, basic_attr_list, identify_attr_list, groups_attr_list, scenes_attr_list); /* Declare endpoint */ ZB_HA_DECLARE_ON_OFF_OUTPUT_EP(on_off_output_ep1, ZB_SWITCH1_ENDPOINT, on_off_output_clusters1); ZB_HA_DECLARE_ON_OFF_OUTPUT_EP(on_off_output_ep2, ZB_SWITCH2_ENDPOINT, on_off_output_clusters2); ZB_HA_DECLARE_ON_OFF_OUTPUT_EP(on_off_output_ep3, ZB_SWITCH3_ENDPOINT, on_off_output_clusters3); /* Declare application's device context for single-endpoint device */ ZBOSS_DECLARE_DEVICE_CTX_3_EP(on_off_output_ctx, on_off_output_ep1, on_off_output_ep2, on_off_output_ep3)
我希望这 3 个端点属于 ON_OFF_OUTPUT 集群类型。
这是一个相关的问题,但它在北欧方面: https://devzone.nordicsemi.com/f/nordic-q-a/84787/zigbee-multiple-same-type-endpoints-conflict-and-proposed-fix 这是 3 年前。