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

esp_zigbee_type.h seems to be missing Zigbee HA standard illuminance sensor clusters. (TZ-1050) #401

Closed
3 tasks done
elgerg opened this issue Aug 8, 2024 · 6 comments
Closed
3 tasks done
Labels

Comments

@elgerg
Copy link

elgerg commented Aug 8, 2024

Answers checklist.

  • I have read the documentation ESP Zigbee SDK Programming Guide and tried the debugging tips, the issue is not addressed there.
  • I have updated ESP Zigbee libs (esp-zboss-lib and esp-zigbee-lib) to the latest version, with corresponding IDF version, and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

n/a

esp-zigbee-lib version.

Current

esp-zboss-lib version.

Unknown, looking at the source in this repo

Espressif SoC revision.

ESP32-H2

What is the expected behavior?

I'd expect a illuminance section in esp_zigbee_type.h similar to:

/**
 * @brief Zigbee HA standard temperature sensor clusters.
 *
 */
typedef struct esp_zb_temperature_sensor_cfg_s {
    esp_zb_basic_cluster_cfg_t basic_cfg;                /*!<  Basic cluster configuration, @ref esp_zb_basic_cluster_cfg_s */
    esp_zb_identify_cluster_cfg_t identify_cfg;          /*!<  Identify cluster configuration, @ref esp_zb_identify_cluster_cfg_s */
    esp_zb_temperature_meas_cluster_cfg_t temp_meas_cfg; /*!<  Temperature measurement cluster configuration, @ref esp_zb_temperature_meas_cluster_cfg_s */
} esp_zb_temperature_sensor_cfg_t;

What is the actual behavior?

Nothing, it's not there

Steps to reproduce.

open esp_zigbee_type.h and search for illuminance, there is only one section for attributes but not one for the cluster.

More Information.

No response

@elgerg elgerg added the Bug label Aug 8, 2024
@github-actions github-actions bot changed the title esp_zigbee_type.h seems to be missing Zigbee HA standard illuminance sensor clusters. esp_zigbee_type.h seems to be missing Zigbee HA standard illuminance sensor clusters. (TZ-1050) Aug 8, 2024
@xieqinan
Copy link
Contributor

xieqinan commented Aug 9, 2024

Hello @elgerg,

I couldn't find the definition for an illuminance sensor in the Zigbee Home Automation specification. Did you mean a light sensor? If so, adding the structure is straightforward. You can follow the code below.

#define ESP_ZB_DEFAULT_LIGHT_SENSOR_CONFIG()                                                            \
    {                                                                                                   \
        .basic_cfg =                                                                                    \
            {                                                                                           \
                .zcl_version = ESP_ZB_ZCL_BASIC_ZCL_VERSION_DEFAULT_VALUE,                              \
                .power_source = ESP_ZB_ZCL_BASIC_POWER_SOURCE_DEFAULT_VALUE,                            \
            },                                                                                          \
        .identify_cfg =                                                                                 \
            {                                                                                           \
                .identify_time = ESP_ZB_ZCL_IDENTIFY_IDENTIFY_TIME_DEFAULT_VALUE,                       \
            },                                                                                          \
        .illuminance_meas_cfg =                                                                         \
            {                                                                                           \
                .measured_value = ESP_ZB_ZCL_ILLUMINANCE_MEASUREMENT_LIGHT_SENSOR_TYPE_DEFAULT_VALUE,   \
                .min_value = ESP_ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MIN_MEASURED_VALUE_MIN_VALUE,      \
                .max_value = ESP_ZB_ZCL_ATTR_ILLUMINANCE_MEASUREMENT_MAX_MEASURED_VALUE_MAX_VALUE,      \
            },                                                                                          \
    }

typedef struct esp_zb_light_sensor_cfg_s {
    esp_zb_basic_cluster_cfg_t basic_cfg;                /*!<  Basic cluster configuration, @ref esp_zb_basic_cluster_cfg_s */
    esp_zb_identify_cluster_cfg_t identify_cfg;          /*!<  Identify cluster configuration, @ref esp_zb_identify_cluster_cfg_s */
    esp_zb_illuminance_meas_cluster_cfg_t illuminance_meas_cfg;
} esp_zb_light_sensor_cfg_t;

We also will consider adding it in next version.

@elgerg
Copy link
Author

elgerg commented Aug 9, 2024

Ah, my bad. I assume light sensor was illuminance based on this being in the header:

/**
 * @brief Zigbee standard mandatory attribute for illuminance measurement cluster
 *
 */
typedef struct esp_zb_illuminance_meas_cluster_cfg_s {
    uint16_t measured_value;                     /*!<  The attribute indicates the illuminance from 0x0000 to 0xffff */
    uint16_t min_value;                          /*!<  The attribute indicates minimum value of the measured value */
    uint16_t max_value;                          /*!<  The attribute indicates maximum value of the measured value */
} esp_zb_illuminance_meas_cluster_cfg_t;

So, to add your code do I need to edit my local version of esp_zigbee_type.h?

Sorry for the dumb questions, I'm trying to get this working under Arduino until the official wrapper is available.

Thanks in advance!

@xieqinan
Copy link
Contributor

@elgerg ,

So, to add your code do I need to edit my local version of esp_zigbee_type.h?

I suggest adding the code to your local file. I'm concerned that adding it to esp_zigbee_type.h in the IDF component might cause a compilation issue.

@P-R-O-C-H-Y
Copy link
Member

P-R-O-C-H-Y commented Aug 14, 2024

Hi @xieqinan, the light sensor is defined in Zigbee Home Automation specification as 0x0106. Can this be added please?
Snímek obrazovky 2024-08-14 v 16 25 45
Found that on multiple places.

@xieqinan
Copy link
Contributor

@P-R-O-C-H-Y

the light sensor is defined in Zigbee Home Automation specification as 0x0106. Can this be added please?

The Light Sensor Number will also be added in the next release. In the meantime, please add it to your local file.

@xieqinan
Copy link
Contributor

@elgerg ,

This issue has been resolved in esp-zigbee-sdk v1.5.0. Please update to this version and test again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants