espressif / esp-zigbee-sdk

Espressif Zigbee SDK
Apache License 2.0
178 stars 31 forks source link

Issue in using on off cluster without any attribute (TZ-985) #381

Closed mundevx closed 2 months ago

mundevx commented 5 months ago

Question

I need to use on-off cluster (cluster id 6), without using any attribute and to use it as switch and 4 endpoints are registered from 1 to 4. On coordinator side, i am using Home Assistant. The disgnostic report showing an extra cluster added (242- Green Proxy Cluster). "endpoints": { "1": { "profile_id": "0x0104", "device_type": "0x0000", "input_clusters": [ "0x0000", "0x0001", "0x0006" ], "output_clusters": [ "0x000a", "0x0019" ] }, "2": { "profile_id": "0x0104", "device_type": "0x0000", "input_clusters": [ "0x0001", "0x0006" ], "output_clusters": [] }, "3": { "profile_id": "0x0104", "device_type": "0x0000", "input_clusters": [ "0x0001", "0x0006" ], "output_clusters": [] }, "4": { "profile_id": "0x0104", "device_type": "0x0000", "input_clusters": [ "0x0001", "0x0006" ], "output_clusters": [] }, "242": { "profile_id": "0xa1e0", "device_type": "0x0061", "input_clusters": [], "output_clusters": [ "0x0021" ] }

The on-off cluster=6, showing attributes, "0x0006": { "endpoint_attribute": "on_off", "attributes": {}, "unsupported_attributes": { "0x4003": { "attribute_name": "start_up_on_off" }, "0x0000": { "attribute_name": "on_off" } } }

espressif code to create clusters is void create_clusters(){ uint8_t test_attr = 0; uint16_t app_version = 66;
uint16_t hw_version = 1; \ uint16_t power_source = ESP_ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE; uint8_t device_enabled = ESP_ZB_ZCL_BASIC_DEVICE_ENABLED_DEFAULT_VALUE; esp_zb_cluster_list_t esp_zb_cluster_list = esp_zb_zcl_cluster_list_create(); / basic cluster create with fully customized / esp_zb_attribute_list_t esp_zb_basic_cluster = esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_BASIC); esp_zb_basic_cluster_add_attr(esp_zb_basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_ZCL_VERSION_ID, &zcl_version); esp_zb_basic_cluster_add_attr(esp_zb_basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_POWER_SOURCE_ID, &power_source); esp_zb_basic_cluster_add_attr(esp_zb_basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_DEVICE_ENABLED_ID, &device_enabled); esp_zb_basic_cluster_add_attr(esp_zb_basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MODEL_IDENTIFIER_ID, &modelid[0]); esp_zb_basic_cluster_add_attr(esp_zb_basic_cluster, ESP_ZB_ZCL_ATTR_BASIC_MANUFACTURER_NAME_ID, &manufname[0]);

esp_zb_attribute_list_t *esp_zb_time_cluster = esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_TIME);
esp_zb_time_cluster_add_attr(esp_zb_time_cluster, ESP_ZB_ZCL_ATTR_TIME_LOCAL_TIME_ID, &test_attr);

esp_zb_identify_cluster_cfg_t identify_cfg = {
    .identify_time = ESP_ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE,
};
esp_zb_attribute_list_t *esp_zb_identify_cluster = esp_zb_identify_cluster_create(&identify_cfg);

uint8_t bat_quantity = 1;
uint8_t bat_size = 1;
uint16_t bat_voltage = 31;
uint16_t bat_percentage = 200;
esp_zb_attribute_list_t *esp_zb_power_cluster = esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_POWER_CONFIG);
esp_zb_power_config_cluster_add_attr(esp_zb_power_cluster, ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_VOLTAGE_ID, &bat_voltage);
esp_zb_power_config_cluster_add_attr(esp_zb_power_cluster, ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_PERCENTAGE_REMAINING_ID, &bat_percentage);
esp_zb_power_config_cluster_add_attr(esp_zb_power_cluster, ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_QUANTITY_ID, &bat_quantity);
esp_zb_power_config_cluster_add_attr(esp_zb_power_cluster, ESP_ZB_ZCL_ATTR_POWER_CONFIG_BATTERY_SIZE_ID, &bat_size);

esp_zb_attribute_list_t *esp_zb_on_off_server_cluster = esp_zb_zcl_attr_list_create(ESP_ZB_ZCL_CLUSTER_ID_ON_OFF);

esp_zb_cluster_list_add_power_config_cluster(esp_zb_cluster_list, esp_zb_power_cluster, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
esp_zb_cluster_list_add_basic_cluster(esp_zb_cluster_list, esp_zb_basic_cluster, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
esp_zb_cluster_list_add_time_cluster(esp_zb_cluster_list, esp_zb_time_cluster, ESP_ZB_ZCL_CLUSTER_CLIENT_ROLE);
esp_zb_cluster_list_add_on_off_cluster(esp_zb_cluster_list, esp_zb_on_off_server_cluster, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);    

}

but i am getting attributes 0x4003 and 0x0000 in on-off cluster and binding with Home Assistant yields unsupported attributes.

Why extra end point cluster greenproxy and extra attributes are adding in on-off cluster.

Additional context.

No response

xieqinan commented 5 months ago

@mundevx,

I need to use on-off cluster (cluster id 6), without using any attribute and to use it as switch and 4 endpoints are registered from 1 to 4.

If you expect the on/off cluster to function as a switch without any attributes, you should set the on/off cluster to the client role.

Why extra end point cluster greenproxy and extra attributes are adding in on-off cluster.

The Zigbee router is required to add the green power proxy by default in Zigbee 3.0; this is not related to the on/off cluster.