fix(zigbee): read fan mode attribute as single byte in FanControl EP (#12346)

This commit is contained in:
Jan Procházka
2026-02-11 10:42:03 +01:00
committed by GitHub
parent 6acc893b85
commit d9deb85317

View File

@@ -54,8 +54,17 @@ void ZigbeeFanControl::zbAttributeSet(const esp_zb_zcl_set_attr_value_message_t
//check the data and call right method
if (message->info.cluster == ESP_ZB_ZCL_CLUSTER_ID_FAN_CONTROL) {
if (message->attribute.id == ESP_ZB_ZCL_ATTR_FAN_CONTROL_FAN_MODE_ID && message->attribute.data.type == ESP_ZB_ZCL_ATTR_TYPE_8BIT_ENUM) {
_current_fan_mode = *(ZigbeeFanMode *)message->attribute.data.value;
fanModeChanged();
if (message->attribute.data.value != nullptr && message->attribute.data.size >= 1) {
uint8_t raw_mode = *(const uint8_t *)message->attribute.data.value;
if (raw_mode <= FAN_MODE_SMART) {
_current_fan_mode = (ZigbeeFanMode)raw_mode;
fanModeChanged();
} else {
log_w("Fan mode value out of range: %u, ignoring", raw_mode);
}
} else {
log_w("Invalid fan mode attribute: value=%p size=%u", message->attribute.data.value, message->attribute.data.size);
}
} else {
log_w("Received message ignored. Attribute ID: %d not supported for Fan Control", message->attribute.id);
}