zbAttributeRead not called on Zigbee endpoint application.

mvermand@gmail.com
Posts: 3
Joined: Fri Dec 15, 2023 7:20 am

zbAttributeRead not called on Zigbee endpoint application.

Postby mvermand@gmail.com » Fri Feb 07, 2025 6:21 am

I have an ESP32-H2 module and I am trying to make an Airco control.
I have configured a Thermostat endpoint (8).
When I change the occupied heating temperature in the Smartthings app, I get the following message on the console of the ESP32-H2 module:

Code: Select all

[316724][V][ZigbeeHandlers.cpp:37] zb_attribute_set_handler(): Received message: endpoint(8), cluster(0x201), attribute(0x12), data size(2)
I have a ZigbeeAirco class that implements

Code: Select all

zbAttributeRead
, but that is not called.

Code: Select all

class ZigbeeAirco : public ZigbeeEP {
public:
  ZigbeeAirco(uint8_t endpoint);
  ~ZigbeeAirco() {}
  ...
  void zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute) override;
};

Code: Select all

ZigbeeAirco::ZigbeeAirco(uint8_t endpoint)
  : ZigbeeEP(endpoint) {
...
   void ZigbeeAirco::zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute) {
     log_v("zbAttributeRead: %d", attribute->id);
   }
...
}
The endpoint and cluster are correct. So why is zbAttributeRead not called?
What do I need to do to be able to handle the received message (in zbAttributeRead?).

Thanks!

mvermand@gmail.com
Posts: 3
Joined: Fri Dec 15, 2023 7:20 am

Re: zbAttributeRead not called on Zigbee endpoint application.

Postby mvermand@gmail.com » Fri Feb 07, 2025 2:20 pm

Found it, I need to implement "zbAttributeSet".

For example:

inside ZigbeeAirco.h:

Code: Select all

class ZigbeeAirco : public ZigbeeEP {
public:
  ZigbeeAirco(uint8_t endpoint);
  ~ZigbeeAirco() {}
  ...
private:
  ...
  void zbAttributeRead(uint16_t cluster_id, const esp_zb_zcl_attribute_t *attribute) override;
  void zbAttributeSet(const esp_zb_zcl_set_attr_value_message_t *message) override;
};
inside ZigbeeAirco.cpp:

Code: Select all

ZigbeeAirco::ZigbeeAirco(uint8_t endpoint)
  : ZigbeeEP(endpoint) {
  ...
  void ZigbeeAirco::zbAttributeSet(const esp_zb_zcl_set_attr_value_message_t *message) {
    log_v("zbAttributeSet: %d", message->attribute.id);
    if (message->info.cluster == ESP_ZB_ZCL_CLUSTER_ID_THERMOSTAT) {
      if (message->attribute.id == ESP_ZB_ZCL_ATTR_THERMOSTAT_OCCUPIED_HEATING_SETPOINT_ID) {
        int16_t heatingSetPoint = *(int16_t *)message->attribute.data.value;
        log_v("heatingSetPoint: %d", heatingSetPoint);
        return;
      } else if (message->attribute.id == ESP_ZB_ZCL_ATTR_THERMOSTAT_OCCUPIED_COOLING_SETPOINT_ID) {
        int16_t coolingSetPoint = *(int16_t *)message->attribute.data.value;
        log_v("coolingSetPoint: %d", coolingSetPoint);
        return;
      } else {
        log_w("Received message ignored. Attribute ID: %d not supported for thermostat", message->attribute.id);
      }
    } else {
      log_w("Received message ignored. Cluster ID: %d not supported", message->info.cluster);
    }
}
}

Who is online

Users browsing this forum: No registered users and 78 guests