@@ -806,7 +806,7 @@ void ZigbeeColorDimmerSwitch::getLightColorHS(uint8_t endpoint, uint16_t short_a
806
806
esp_zb_zcl_read_attr_cmd_req (&read_req);
807
807
esp_zb_lock_release ();
808
808
}
809
- }
809
+ }
810
810
811
811
void ZigbeeColorDimmerSwitch::getLightColorHS (uint8_t endpoint, esp_zb_ieee_addr_t ieee_addr) {
812
812
if (_is_bound) {
@@ -826,7 +826,9 @@ void ZigbeeColorDimmerSwitch::getLightColorHS(uint8_t endpoint, esp_zb_ieee_addr
826
826
}
827
827
}
828
828
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
+ ) {
830
832
if (cluster_id == ESP_ZB_ZCL_CLUSTER_ID_ON_OFF) {
831
833
if (attribute->id == ESP_ZB_ZCL_ATTR_ON_OFF_ON_OFF_ID && attribute->data .type == ESP_ZB_ZCL_ATTR_TYPE_BOOL) {
832
834
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_
854
856
static bool y_received = false ;
855
857
static bool h_received = false ;
856
858
static bool s_received = false ;
857
-
859
+
858
860
if (attribute->id == ESP_ZB_ZCL_ATTR_COLOR_CONTROL_CURRENT_X_ID && attribute->data .type == ESP_ZB_ZCL_ATTR_TYPE_U16) {
859
861
_light_color_xy.x = attribute->data .value ? *(uint16_t *)attribute->data .value : 0 ;
860
862
x_received = true ;
@@ -863,7 +865,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
863
865
_light_color_xy.y = attribute->data .value ? *(uint16_t *)attribute->data .value : 0 ;
864
866
y_received = true ;
865
867
}
866
-
868
+
867
869
if (attribute->id == ESP_ZB_ZCL_ATTR_COLOR_CONTROL_CURRENT_HUE_ID && attribute->data .type == ESP_ZB_ZCL_ATTR_TYPE_U8) {
868
870
_light_color_hsv.h = attribute->data .value ? *(uint8_t *)attribute->data .value : 0 ;
869
871
h_received = true ;
@@ -872,7 +874,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
872
874
_light_color_hsv.s = attribute->data .value ? *(uint8_t *)attribute->data .value : 0 ;
873
875
s_received = true ;
874
876
}
875
-
877
+
876
878
// Process XY color if both X and Y have been received
877
879
if (x_received && y_received) {
878
880
_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_
882
884
if (_on_light_color_change_with_source) {
883
885
_on_light_color_change_with_source (_light_color_rgb.r , _light_color_rgb.g , _light_color_rgb.b , src_endpoint, src_address);
884
886
}
885
- x_received = false ; // Reset flags after processing
887
+ x_received = false ; // Reset flags after processing
886
888
y_received = false ;
887
889
}
888
-
890
+
889
891
// Process HS color if both H and S have been received
890
892
if (h_received && s_received) {
891
893
_light_color_rgb = espHsvColorToRgbColor (_light_color_hsv);
@@ -895,7 +897,7 @@ void ZigbeeColorDimmerSwitch::zbAttributeRead(uint16_t cluster_id, const esp_zb_
895
897
if (_on_light_color_change_with_source) {
896
898
_on_light_color_change_with_source (_light_color_rgb.r , _light_color_rgb.g , _light_color_rgb.b , src_endpoint, src_address);
897
899
}
898
- h_received = false ; // Reset flags after processing
900
+ h_received = false ; // Reset flags after processing
899
901
s_received = false ;
900
902
}
901
903
}
0 commit comments