Skip to content
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

Question: Reporting of AnalogInput Cluster -> PresentValue (IDFGH-14497) #15266

Open
ummarbhutta opened this issue Jan 23, 2025 · 0 comments
Open
Assignees
Labels
Status: Opened Issue is new

Comments

@ummarbhutta
Copy link

Hi,

I am building a sensor using ESP32H2, which will measure weight and transmit it over AnalogInput->PresentValue to the network. Following are details

Hardware platform: esp32h2
ESP-IDF version: v5.3.2
Type of device: Zigbee end device
Cluster used: AnalogInput
Attribute used: PresentValue
Home Automation System: HomeAssistant (v 2025.1)
Network: 35+ devices (mesh)
Sensor -> Coordinator: This sensor is placed far from coordinator, so no direct connection, but joins network using Routers and have good signal strength.

Problem # 1 - How to configure reporting:

  • I am having hard time to find any documentation/reference code to configure reporting from this end device, I know there is a way but can't make it work. The solution which I am using is as follows, i.e., defining the function below and calling it as per my needs, but no way to automatic report configuration, so that I only call esp_zb_zcl_set_attribute_val and rest is done automatically.
void report_weight_attr(uint8_t ep)
{
    esp_zb_zcl_report_attr_cmd_t report_attr_cmd = {
        .address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT,
        .attributeID = ESP_ZB_ZCL_ATTR_ANALOG_INPUT_PRESENT_VALUE_ID,
        .direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI,
        .clusterID = ESP_ZB_ZCL_CLUSTER_ID_ANALOG_INPUT,
        .zcl_basic_cmd.src_endpoint = ep};

    esp_zb_lock_acquire(portMAX_DELAY);
    esp_err_t status = esp_zb_zcl_report_attr_cmd_req(&report_attr_cmd);
    esp_zb_lock_release();
    if (status == ESP_OK)
    {
        ESP_LOGI(TAG, "Send Weight 'report attributes' command");
    }
    else
    {
        ESP_LOGE(TAG, "Send Weight failed, with error code '%d'", status);
    }
}

Problem # 2 (may be not directly related to this community):

Even with the above code the HomeAssistant doesn't show values directly unless I call Read Attribute explicitly, details are already added here.

For sake of testing, if I publish the report on HumidityMeasurement cluster as below, everything starts working fine (Entities are updated on HomeAssistance as soon as reported from FW).

void report_weight_attr(uint8_t ep)
{
     esp_zb_zcl_report_attr_cmd_t report_attr_cmd = {
         .address_mode = ESP_ZB_APS_ADDR_MODE_DST_ADDR_ENDP_NOT_PRESENT,
         .attributeID = ESP_ZB_ZCL_ATTR_REL_HUMIDITY_MEASUREMENT_VALUE_ID,
         .direction = ESP_ZB_ZCL_CMD_DIRECTION_TO_CLI,
         .clusterID = ESP_ZB_ZCL_CLUSTER_ID_REL_HUMIDITY_MEASUREMENT,
         .zcl_basic_cmd.src_endpoint = ep};

     esp_zb_lock_acquire(portMAX_DELAY);
     esp_err_t status = esp_zb_zcl_report_attr_cmd_req(&report_attr_cmd);
     esp_zb_lock_release();
     if (status == ESP_OK)
     {
         ESP_LOGI(TAG, "Send Weight 'report attributes' command");
     }
     else
     {
         ESP_LOGE(TAG, "Send Weight failed, with error code '%d'", status);
     }
}

Questions:

  • Can anyone help me on problem # 1 and point me to a reference code.
  • Is problem # 2, related to ESP-IDF or perhaps a quirk thing on HomeAssistant? I hope there is not a special way to publish report for AnalogInput cluster, and also I have not hit some bug in under laying zigbee API?
@espressif-bot espressif-bot added the Status: Opened Issue is new label Jan 23, 2025
@github-actions github-actions bot changed the title Question: Reporting of AnalogInput Cluster -> PresentValue Question: Reporting of AnalogInput Cluster -> PresentValue (IDFGH-14497) Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants