-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot set present value attribute of binary input cluster (TZ-1486) #537
Comments
I have a similar issue. It's not clear to me that the PresentValue (0x55) attribute is added to the cluster by If I use
If I manually add the attribute as a bool type according to the spec, I can use
However, I am unable to then set the value using I have guess and checked many combinations of configuration (erase-flash between each) to no avail. Is there a means in the API (esp or zboss) to enumerate what attributes are attached to the cluster(s) after registration? |
Hi @jonasbu01, @asward, The The code below provides a reference for adding this attribute: #define HA_ESP_LIGHT_ENDPOINT 1
esp_zb_cluster_list_t *esp_zb_cluster_list = esp_zb_zcl_cluster_list_create();
esp_zb_binary_input_cluster_cfg_t binary_input_cfg = {
.out_of_service = false,
.status_flags = ESP_ZB_ZCL_BINARY_INPUT_STATUS_FLAG_DEFAULT_VALUE,
};
esp_zb_attribute_list_t *binary_input_cluster = esp_zb_binary_input_cluster_create(&binary_input_cfg);
bool binary_input_present_value = 0;
esp_zb_binary_input_cluster_add_attr(binary_input_cluster, ESP_ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID,
&binary_input_present_value);
esp_zb_cluster_list_add_binary_input_cluster(esp_zb_cluster_list, binary_input_cluster,
ESP_ZB_ZCL_CLUSTER_SERVER_ROLE);
esp_zb_ep_list_t *esp_zb_ep_list = esp_zb_ep_list_create();
/* add created endpoint (cluster_list) to endpoint list */
esp_zb_endpoint_config_t endpoint_config = {
.endpoint = HA_ESP_LIGHT_ENDPOINT,
.app_profile_id = ESP_ZB_AF_HA_PROFILE_ID,
.app_device_id = ESP_ZB_HA_ON_OFF_LIGHT_DEVICE_ID,
.app_device_version = 0
};
esp_zb_ep_list_add_ep(esp_zb_ep_list, esp_zb_cluster_list, endpoint_config);
esp_zb_device_register(esp_zb_ep_list);
binary_input_present_value = 1;
esp_zb_zcl_status_t res = esp_zb_zcl_set_attribute_val(
HA_ESP_LIGHT_ENDPOINT, ESP_ZB_ZCL_CLUSTER_ID_BINARY_INPUT, ESP_ZB_ZCL_CLUSTER_SERVER_ROLE,
ESP_ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID, &binary_input_present_value, false);
ESP_LOGW(TAG, "resp status: 0x%x", res);
esp_zb_zcl_attr_t *attr =
esp_zb_zcl_get_attribute(HA_ESP_LIGHT_ENDPOINT, ESP_ZB_ZCL_CLUSTER_ID_BINARY_INPUT,
ESP_ZB_ZCL_CLUSTER_SERVER_ROLE, ESP_ZB_ZCL_ATTR_BINARY_INPUT_PRESENT_VALUE_ID);
ESP_LOGW(TAG, "binary input present value: 0x%x", *(uint8_t *)attr->data_p); |
The present value attribute is a mandatory parameter for the binary input (basic) cluster. Is there a reason to exclude it from the cluster generation initially? Further, is it possible to know what the esp zigbee api will provide as far as 'default' attributes for standard clusters? Either documentation or run-time reporting? Without initializing the attribute (one way or another) a call to I believe I had used |
@asward ,
I believe the only reason is its omission. We will include it in the next version.
For standard cluster creation, mandatory attributes are added by default. You can also refer to the input parameters of the creation API, such as: esp_zb_attribute_list_t *esp_zb_binary_input_cluster_create(esp_zb_binary_input_cluster_cfg_t *binary_input_cfg) The
It is an optimization point, and we will consider it.
The root of the two APIs is the same: |
@xieqinan I appreciate your efforts on this library! Thanks for all of those answers, it does clear things up a bit. Hopefully @jonasbu01 was able to resolve his issues as well. |
Question
We are attempting to set the value of the present value attribute of the binary input cluster as follows:
However,
esp_zb_zcl_set_attribute_val
constantly returns1
indicating an error. Even though the attribute should be writable according to the Zigbee Cluster API specification. We have also tried to makevalue
of typeuint8_t
but leads to the same result. Can you give a hint how to resolve this problem?Additional context.
We are creating the endpoint as follows:
The text was updated successfully, but these errors were encountered: