diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index 02dc0b790..5ec00c859 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -1263,14 +1263,24 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_ } } + /* Features */ + if (features & feature::off_only::get_id()) { + feature::off_only::add(cluster); + } + else { + if (features & feature::lighting::get_id()) { + feature::lighting::add(cluster, &(config->lighting)); + } + if (features & feature::dead_front_behavior::get_id()) { + feature::dead_front_behavior::add(cluster); + } + } + /* Commands */ command::create_off(cluster); - command::create_on(cluster); - command::create_toggle(cluster); - - /* Features */ - if (features & feature::lighting::get_id()) { - feature::lighting::add(cluster, &(config->lighting)); + if (!(features & feature::off_only::get_id())) { + command::create_on(cluster); + command::create_toggle(cluster); } return cluster; diff --git a/components/esp_matter/esp_matter_feature.cpp b/components/esp_matter/esp_matter_feature.cpp index c05d6ba04..d9f924b02 100644 --- a/components/esp_matter/esp_matter_feature.cpp +++ b/components/esp_matter/esp_matter_feature.cpp @@ -380,6 +380,26 @@ esp_err_t add(cluster_t *cluster) } } /* dead_front_behavior */ + +namespace off_only { + +uint32_t get_id() +{ + return (uint32_t)OnOff::Feature::kOffOnly; +} + +esp_err_t add(cluster_t *cluster) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + return ESP_OK; +} + +} /* off_only */ } /* feature */ } /* on_off */ diff --git a/components/esp_matter/esp_matter_feature.h b/components/esp_matter/esp_matter_feature.h index ba153b5eb..6d35f444f 100644 --- a/components/esp_matter/esp_matter_feature.h +++ b/components/esp_matter/esp_matter_feature.h @@ -169,6 +169,13 @@ uint32_t get_id(); esp_err_t add(cluster_t *cluster); } /* dead_front_behavior */ + +namespace off_only { + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster); + +} /* off_only */ } /* feature */ } /* on_off */