@@ -806,7 +806,7 @@ void ZigbeeColorDimmerSwitch::getLightColorHS(uint8_t endpoint, uint16_t short_a
806806    esp_zb_zcl_read_attr_cmd_req (&read_req);
807807    esp_zb_lock_release ();
808808  }
809- }  
809+ }
810810
811811void  ZigbeeColorDimmerSwitch::getLightColorHS (uint8_t  endpoint, esp_zb_ieee_addr_t  ieee_addr) {
812812  if  (_is_bound) {
@@ -826,7 +826,9 @@ void ZigbeeColorDimmerSwitch::getLightColorHS(uint8_t endpoint, esp_zb_ieee_addr
826826  }
827827}
828828
829- void  ZigbeeColorDimmerSwitch::zbAttributeRead (uint16_t  cluster_id, const  esp_zb_zcl_attribute_t  *attribute, uint8_t  src_endpoint, esp_zb_zcl_addr_t  src_address) {
829+ void  ZigbeeColorDimmerSwitch::zbAttributeRead (
830+   uint16_t  cluster_id, const  esp_zb_zcl_attribute_t  *attribute, uint8_t  src_endpoint, esp_zb_zcl_addr_t  src_address
831+ ) {
830832  if  (cluster_id == ESP_ZB_ZCL_CLUSTER_ID_ON_OFF) {
831833    if  (attribute->id  == ESP_ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID && attribute->data .type  == ESP_ZB_ZCL_ATTR_TYPE_BOOL) {
832834      bool  light_state = attribute->data .value  ? *(bool  *)attribute->data .value  : false ;
@@ -854,7 +856,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
854856    static  bool  y_received = false ;
855857    static  bool  h_received = false ;
856858    static  bool  s_received = false ;
857-      
859+ 
858860    if  (attribute->id  == ESP_ZB_ZCL_ATTR_COLOR_CONTROL_CURRENT_X_ID && attribute->data .type  == ESP_ZB_ZCL_ATTR_TYPE_U16) {
859861      _light_color_xy.x  = attribute->data .value  ? *(uint16_t  *)attribute->data .value  : 0 ;
860862      x_received = true ;
@@ -863,7 +865,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
863865      _light_color_xy.y  = attribute->data .value  ? *(uint16_t  *)attribute->data .value  : 0 ;
864866      y_received = true ;
865867    }
866-      
868+ 
867869    if  (attribute->id  == ESP_ZB_ZCL_ATTR_COLOR_CONTROL_CURRENT_HUE_ID && attribute->data .type  == ESP_ZB_ZCL_ATTR_TYPE_U8) {
868870      _light_color_hsv.h  = attribute->data .value  ? *(uint8_t  *)attribute->data .value  : 0 ;
869871      h_received = true ;
@@ -872,7 +874,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
872874      _light_color_hsv.s  = attribute->data .value  ? *(uint8_t  *)attribute->data .value  : 0 ;
873875      s_received = true ;
874876    }
875-      
877+ 
876878    //  Process XY color if both X and Y have been received
877879    if  (x_received && y_received) {
878880      _light_color_rgb = espXYToRgbColor (255 , _light_color_xy.x , _light_color_xy.y , false );
@@ -882,10 +884,10 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
882884      if  (_on_light_color_change_with_source) {
883885        _on_light_color_change_with_source (_light_color_rgb.r , _light_color_rgb.g , _light_color_rgb.b , src_endpoint, src_address);
884886      }
885-       x_received = false ; //  Reset flags after processing
887+       x_received = false ;   //  Reset flags after processing
886888      y_received = false ;
887889    }
888-      
890+ 
889891    //  Process HS color if both H and S have been received
890892    if  (h_received && s_received) {
891893      _light_color_rgb = espHsvColorToRgbColor (_light_color_hsv);
@@ -895,7 +897,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
895897      if  (_on_light_color_change_with_source) {
896898        _on_light_color_change_with_source (_light_color_rgb.r , _light_color_rgb.g , _light_color_rgb.b , src_endpoint, src_address);
897899      }
898-       h_received = false ; //  Reset flags after processing
900+       h_received = false ;   //  Reset flags after processing
899901      s_received = false ;
900902    }
901903  }
0 commit comments