Merge branch 'fix/remove-extra-elements' into 'main'

Remove Extra Attributes, Commands, and Events from esp_matter

See merge request app-frameworks/esp-matter!1311
This commit is contained in:
Hrishikesh Dhayagude
2025-12-01 21:05:35 +08:00
9 changed files with 0 additions and 266 deletions
@@ -2010,12 +2010,6 @@ attribute_t *create_pi_heating_demand(cluster_t *cluster, uint8_t value)
esp_matter_uint8(value));
}
attribute_t *create_hvac_system_type_config(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::HVACSystemTypeConfiguration::Id,
ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE, esp_matter_bitmap8(value));
}
attribute_t *create_local_temperature_calibration(cluster_t *cluster, int8_t value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::LocalTemperatureCalibration::Id,
@@ -2100,24 +2094,6 @@ attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value)
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
}
attribute_t *create_start_of_week(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::StartOfWeek::Id, ATTRIBUTE_FLAG_NONE,
esp_matter_enum8(value));
}
attribute_t *create_number_of_weekly_transitions(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::NumberOfWeeklyTransitions::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint8(value));
}
attribute_t *create_number_of_daily_transitions(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::NumberOfDailyTransitions::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_enum8(value));
}
attribute_t *create_temperature_setpoint_hold(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, Thermostat::Attributes::TemperatureSetpointHold::Id,
@@ -2968,32 +2944,6 @@ attribute_t *create_type(cluster_t *cluster, uint8_t value)
esp_matter_enum8(value));
}
attribute_t *create_physical_closed_limit_lift(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::PhysicalClosedLimitLift::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
}
attribute_t *create_physical_closed_limit_tilt(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::PhysicalClosedLimitTilt::Id,
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
}
attribute_t *create_current_position_lift(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionLift::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_current_position_tilt(cluster_t *cluster, nullable<uint16_t> value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::CurrentPositionTilt::Id,
ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE,
esp_matter_nullable_uint16(value));
}
attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::NumberOfActuationsLift::Id,
@@ -3064,30 +3014,6 @@ attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nul
esp_matter_nullable_uint16(value));
}
attribute_t *create_installed_open_limit_lift(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::InstalledOpenLimitLift::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
}
attribute_t *create_installed_closed_limit_lift(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::InstalledClosedLimitLift::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
}
attribute_t *create_installed_open_limit_tilt(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::InstalledOpenLimitTilt::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
}
attribute_t *create_installed_closed_limit_tilt(cluster_t *cluster, uint16_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::InstalledClosedLimitTilt::Id,
ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_uint16(value));
}
attribute_t *create_mode(cluster_t *cluster, uint8_t value)
{
return esp_matter::attribute::create(cluster, WindowCovering::Attributes::Mode::Id, ATTRIBUTE_FLAG_NONVOLATILE | ATTRIBUTE_FLAG_WRITABLE,
@@ -487,7 +487,6 @@ attribute_t *create_abs_min_cool_setpoint_limit(cluster_t *cluster, int16_t valu
attribute_t *create_abs_max_cool_setpoint_limit(cluster_t *cluster, int16_t value);
attribute_t *create_pi_cooling_demand(cluster_t *cluster, uint8_t value);
attribute_t *create_pi_heating_demand(cluster_t *cluster, uint8_t value);
attribute_t *create_hvac_system_type_config(cluster_t *cluster, uint8_t value);
attribute_t *create_local_temperature_calibration(cluster_t *cluster, int8_t value);
attribute_t *create_occupied_cooling_setpoint(cluster_t *cluster, int16_t value);
attribute_t *create_occupied_heating_setpoint(cluster_t *cluster, int16_t value);
@@ -502,9 +501,6 @@ attribute_t *create_remote_sensing(cluster_t *cluster, uint8_t value);
attribute_t *create_control_sequence_of_operation(cluster_t *cluster, uint8_t value);
attribute_t *create_system_mode(cluster_t *cluster, uint8_t value);
attribute_t *create_thermostat_running_mode(cluster_t *cluster, uint8_t value);
attribute_t *create_start_of_week(cluster_t *cluster, uint8_t value);
attribute_t *create_number_of_weekly_transitions(cluster_t *cluster, uint8_t value);
attribute_t *create_number_of_daily_transitions(cluster_t *cluster, uint8_t value);
attribute_t *create_temperature_setpoint_hold(cluster_t *cluster, uint8_t value);
attribute_t *create_temperature_setpoint_hold_duration(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_thermostat_programming_operation_mode(cluster_t *cluster, uint8_t value);
@@ -735,10 +731,6 @@ attribute_t *create_expiry_date(cluster_t *cluster, uint32_t value);
namespace window_covering {
namespace attribute {
attribute_t *create_type(cluster_t *cluster, uint8_t value);
attribute_t *create_physical_closed_limit_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_physical_closed_limit_tilt(cluster_t *cluster, uint16_t value);
attribute_t *create_current_position_lift(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_current_position_tilt(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_number_of_actuations_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_number_of_actuations_tilt(cluster_t *cluster, uint16_t value);
attribute_t *create_config_status(cluster_t *cluster, uint8_t value);
@@ -750,10 +742,6 @@ attribute_t *create_target_position_tilt_percent_100ths(cluster_t *cluster, null
attribute_t *create_end_product_type(cluster_t *cluster, const uint8_t value);
attribute_t *create_current_position_lift_percent_100ths(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_current_position_tilt_percent_100ths(cluster_t *cluster, nullable<uint16_t> value);
attribute_t *create_installed_open_limit_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_installed_closed_limit_lift(cluster_t *cluster, uint16_t value);
attribute_t *create_installed_open_limit_tilt(cluster_t *cluster, uint16_t value);
attribute_t *create_installed_closed_limit_tilt(cluster_t *cluster, uint16_t value);
attribute_t *create_mode(cluster_t *cluster, uint8_t value);
attribute_t *create_safety_status(cluster_t *cluster, uint16_t value);
} /* attribute */
@@ -2082,10 +2082,6 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
feature::position_aware_tilt::add(cluster, &(config->features.position_aware_tilt));
}
}
// optional if absolute position is supported
if (has(feature::absolute_position::get_id())) {
feature::absolute_position::add(cluster, &(config->features.absolute_position));
}
}
if (flags & CLUSTER_FLAG_CLIENT) {
@@ -538,7 +538,6 @@ typedef struct config {
uint8_t mode;
struct {
feature::position_aware_lift::config_t position_aware_lift;
feature::absolute_position::config_t absolute_position;
feature::position_aware_tilt::config_t position_aware_tilt;
} features;
uint32_t feature_flags;
@@ -829,39 +829,6 @@ static esp_err_t esp_matter_command_callback_setpoint_raise_lower(const Concrete
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_set_weekly_schedule(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
chip::app::Clusters::Thermostat::Commands::SetWeeklySchedule::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfThermostatClusterSetWeeklyScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_get_weekly_schedule(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
chip::app::Clusters::Thermostat::Commands::GetWeeklySchedule::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfThermostatClusterGetWeeklyScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_clear_weekly_schedule(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
chip::app::Clusters::Thermostat::Commands::ClearWeeklySchedule::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfThermostatClusterClearWeeklyScheduleCallback((CommandHandler *)opaque_ptr, command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_set_active_schedule_request(const ConcreteCommandPath &command_path,
TLVReader &tlv_data, void *opaque_ptr)
{
@@ -939,17 +906,6 @@ static esp_err_t esp_matter_command_callback_stop_motion(const ConcreteCommandPa
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_go_to_lift_value(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr)
{
chip::app::Clusters::WindowCovering::Commands::GoToLiftValue::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfWindowCoveringClusterGoToLiftValueCallback((CommandHandler *)opaque_ptr, command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_go_to_lift_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr)
{
@@ -961,17 +917,6 @@ static esp_err_t esp_matter_command_callback_go_to_lift_percentage(const Concret
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_go_to_tilt_value(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr)
{
chip::app::Clusters::WindowCovering::Commands::GoToTiltValue::DecodableType command_data;
CHIP_ERROR error = Decode(tlv_data, command_data);
if (error == CHIP_NO_ERROR) {
emberAfWindowCoveringClusterGoToTiltValueCallback((CommandHandler *)opaque_ptr, command_path, command_data);
}
return ESP_OK;
}
static esp_err_t esp_matter_command_callback_go_to_tilt_percentage(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
void *opaque_ptr)
{
@@ -2229,30 +2174,6 @@ command_t *create_setpoint_raise_lower(cluster_t *cluster)
esp_matter_command_callback_setpoint_raise_lower);
}
command_t *create_set_weekly_schedule(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Thermostat::Commands::SetWeeklySchedule::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_set_weekly_schedule);
}
command_t *create_get_weekly_schedule(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Thermostat::Commands::GetWeeklySchedule::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_get_weekly_schedule);
}
command_t *create_clear_weekly_schedule(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Thermostat::Commands::ClearWeeklySchedule::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_clear_weekly_schedule);
}
command_t *create_get_weekly_schedule_response(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Thermostat::Commands::GetWeeklyScheduleResponse::Id, COMMAND_FLAG_ACCEPTED,
NULL);
}
command_t *create_set_active_schedule_request(cluster_t *cluster)
{
return esp_matter::command::create(cluster, Thermostat::Commands::SetActiveScheduleRequest::Id, COMMAND_FLAG_ACCEPTED,
@@ -2510,24 +2431,12 @@ command_t *create_stop_motion(cluster_t *cluster)
esp_matter_command_callback_stop_motion);
}
command_t *create_go_to_lift_value(cluster_t *cluster)
{
return esp_matter::command::create(cluster, WindowCovering::Commands::GoToLiftValue::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_go_to_lift_value);
}
command_t *create_go_to_lift_percentage(cluster_t *cluster)
{
return esp_matter::command::create(cluster, WindowCovering::Commands::GoToLiftPercentage::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_go_to_lift_percentage);
}
command_t *create_go_to_tilt_value(cluster_t *cluster)
{
return esp_matter::command::create(cluster, WindowCovering::Commands::GoToTiltValue::Id, COMMAND_FLAG_ACCEPTED,
esp_matter_command_callback_go_to_tilt_value);
}
command_t *create_go_to_tilt_percentage(cluster_t *cluster)
{
return esp_matter::command::create(cluster, WindowCovering::Commands::GoToTiltPercentage::Id, COMMAND_FLAG_ACCEPTED,
@@ -282,10 +282,6 @@ command_t *create_color_loop_set(cluster_t *cluster);
namespace thermostat {
namespace command {
command_t *create_setpoint_raise_lower(cluster_t *cluster);
command_t *create_set_weekly_schedule(cluster_t *cluster);
command_t *create_get_weekly_schedule(cluster_t *cluster);
command_t *create_clear_weekly_schedule(cluster_t *cluster);
command_t *create_get_weekly_schedule_response(cluster_t *cluster);
command_t *create_set_active_schedule_request(cluster_t *cluster);
command_t *create_set_active_preset_request(cluster_t *cluster);
command_t *create_atomic_request(cluster_t *cluster);
@@ -349,9 +345,7 @@ namespace command {
command_t *create_up_or_open(cluster_t *cluster);
command_t *create_down_or_close(cluster_t *cluster);
command_t *create_stop_motion(cluster_t *cluster);
command_t *create_go_to_lift_value(cluster_t *cluster);
command_t *create_go_to_lift_percentage(cluster_t *cluster);
command_t *create_go_to_tilt_value(cluster_t *cluster);
command_t *create_go_to_tilt_percentage(cluster_t *cluster);
} /* command */
} /* window_covering */
@@ -835,62 +835,6 @@ esp_err_t add(cluster_t *cluster, config_t *config)
}
} /* position_aware_lift */
namespace absolute_position {
uint32_t get_id()
{
return (uint32_t)WindowCovering::Feature::kAbsolutePosition;
}
esp_err_t add(cluster_t *cluster, config_t *config)
{
VerifyOrReturnError(cluster, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Cluster cannot be NULL"));
update_feature_map(cluster, get_id());
uint32_t abs_and_pa_lf_and_lf_feature_map = get_id() | feature::position_aware_lift::get_id() | feature::lift::get_id();
uint32_t abs_and_pa_tl_and_tl_feature_map = get_id() | feature::position_aware_tilt::get_id() | feature::tilt::get_id();
uint32_t abs_and_lift_feature_map = get_id() | feature::lift::get_id();
uint32_t abs_and_tilt_feature_map = get_id() | feature::tilt::get_id();
if (
(get_feature_map_value(cluster) & abs_and_pa_lf_and_lf_feature_map) != abs_and_pa_lf_and_lf_feature_map
&& (get_feature_map_value(cluster) & abs_and_pa_tl_and_tl_feature_map) != abs_and_pa_tl_and_tl_feature_map
&& (get_feature_map_value(cluster) & abs_and_lift_feature_map) != abs_and_lift_feature_map
&& (get_feature_map_value(cluster) & abs_and_tilt_feature_map) != abs_and_tilt_feature_map
) {
ESP_LOGE(TAG, "Cluster shall support Lift (and optionally Position_Aware_Lift) and/or Tilt (and optionally Position_Aware_Tilt) features");
return ESP_ERR_NOT_SUPPORTED;
}
if ((get_feature_map_value(cluster) & abs_and_pa_lf_and_lf_feature_map) == abs_and_pa_lf_and_lf_feature_map) {
attribute::create_installed_open_limit_lift(cluster, config->installed_open_limit_lift);
attribute::create_installed_closed_limit_lift(cluster, config->installed_closed_limit_lift);
} else {
ESP_LOGW(TAG, "Lift related attributes were not created because cluster does not support Position_Aware_Lift feature");
}
if ((get_feature_map_value(cluster) & abs_and_pa_tl_and_tl_feature_map) == abs_and_pa_tl_and_tl_feature_map) {
attribute::create_installed_open_limit_tilt(cluster, config->installed_open_limit_tilt);
attribute::create_installed_closed_limit_tilt(cluster, config->installed_closed_limit_tilt);
} else {
ESP_LOGW(TAG, "Tilt related attributes were not created because cluster does not support Position_Aware_Tilt feature");
}
if ((get_feature_map_value(cluster) & abs_and_lift_feature_map) == abs_and_lift_feature_map) {
command::create_go_to_lift_value(cluster);
} else {
ESP_LOGW(TAG, "Lift commands were not created because cluster does not support Lift feature");
}
if ((get_feature_map_value(cluster) & abs_and_tilt_feature_map) == abs_and_tilt_feature_map) {
command::create_go_to_tilt_value(cluster);
} else {
ESP_LOGW(TAG, "Tilt commands were not created because cluster does not support Tilt feature");
}
return ESP_OK;
}
} /* absolute_position */
namespace position_aware_tilt {
uint32_t get_id()
@@ -1447,7 +1391,6 @@ esp_err_t add(cluster_t *cluster)
attribute::create_smoke_state(cluster, 0);
event::create_smoke_alarm(cluster);
event::create_interconnect_smoke_alarm(cluster);
return ESP_OK;
}
@@ -1469,7 +1412,6 @@ esp_err_t add(cluster_t *cluster)
attribute::create_co_state(cluster, 0);
event::create_co_alarm(cluster);
event::create_interconnect_co_alarm(cluster);
return ESP_OK;
}
@@ -393,24 +393,6 @@ esp_err_t add(cluster_t *cluster, config_t *config);
} /* position_aware_lift */
// Attributes of AbsolutePosition feature may have dependency on LF, TL, PA_LF, PA_TL
// feature, one must add features according to the usecase first.
namespace absolute_position {
typedef struct config {
uint16_t installed_open_limit_lift;
uint16_t installed_closed_limit_lift;
uint16_t installed_open_limit_tilt;
uint16_t installed_closed_limit_tilt;
config() : installed_open_limit_lift(0), installed_closed_limit_lift(65534), installed_open_limit_tilt(0), installed_closed_limit_tilt(65534) {}
} config_t;
uint32_t get_id();
esp_err_t add(cluster_t *cluster, config_t *config);
} /* absolute_position */
// PositionAwareTilt feature is dependent on Tilt feature, in order to add
// PositionAwareTilt feature one must add Tilt feature first.
@@ -291,14 +291,12 @@ int create(uint8_t device_type_index)
endpoint = esp_matter::endpoint::window_covering::create(node, &window_covering_config, ENDPOINT_FLAG_NONE, NULL);
cluster_t *cluster = cluster::get(endpoint, chip::app::Clusters::WindowCovering::Id);
cluster::window_covering::feature::position_aware_lift::config_t position_aware_lift;
cluster::window_covering::feature::absolute_position::config_t absolute_position;
nullable<uint16_t> percentage_100ths = nullable<uint16_t>(0);
position_aware_lift.target_position_lift_percent_100ths = percentage_100ths;
position_aware_lift.current_position_lift_percent_100ths = percentage_100ths;
cluster::window_covering::feature::position_aware_lift::add(cluster, &position_aware_lift);
cluster::window_covering::feature::absolute_position::add(cluster, &absolute_position);
break;
}
case ESP_MATTER_TEMP_SENSOR: {