mirror of
https://github.com/espressif/arduino-esp32.git
synced 2026-03-13 09:41:48 +08:00
fix(zigbee): read fan mode attribute as single byte in FanControl EP (#12346)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user