Skip to content

Commit 1f41719

Browse files
committed
Merge branch 'add/scenes' into 'main'
[data_model] Create scenes cluster in device type according to conformance. See merge request app-frameworks/esp-matter!1230
2 parents f7f5c65 + 880d899 commit 1f41719

File tree

2 files changed

+46
-22
lines changed

2 files changed

+46
-22
lines changed

components/esp_matter/data_model/esp_matter_endpoint.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
224224
on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
225225
on_off::command::create_on(on_off_cluster);
226226
on_off::command::create_toggle(on_off_cluster);
227+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
228+
scenes_management::command::create_copy_scene(scenes_management_cluster);
229+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
227230

228231
return ESP_OK;
229232
}
@@ -261,6 +264,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
261264
cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
262265
level_control::feature::on_off::add(level_control_cluster);
263266
level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
267+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
268+
scenes_management::command::create_copy_scene(scenes_management_cluster);
269+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
264270

265271
return ESP_OK;
266272
}
@@ -301,6 +307,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
301307
color_control::feature::color_temperature::add(color_control_cluster, &(config->color_control_color_temperature));
302308
color_control::attribute::create_remaining_time(color_control_cluster, config->color_control_remaining_time);
303309
color_control::command::create_stop_move_step(color_control_cluster);
310+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
311+
scenes_management::command::create_copy_scene(scenes_management_cluster);
312+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
304313

305314
return ESP_OK;
306315
}
@@ -343,6 +352,10 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
343352
color_control::feature::xy::add(color_control_cluster, &(config->color_control_xy));
344353
color_control::attribute::create_remaining_time(color_control_cluster, config->color_control_remaining_time);
345354
color_control::command::create_stop_move_step(color_control_cluster);
355+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
356+
scenes_management::command::create_copy_scene(scenes_management_cluster);
357+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
358+
346359
return ESP_OK;
347360
}
348361
} /* extended_color_light */
@@ -509,6 +522,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
509522
on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
510523
on_off::command::create_on(on_off_cluster);
511524
on_off::command::create_toggle(on_off_cluster);
525+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
526+
scenes_management::command::create_copy_scene(scenes_management_cluster);
527+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
512528

513529
return ESP_OK;
514530
}
@@ -545,6 +561,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
545561
cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
546562
level_control::feature::on_off::add(level_control_cluster);
547563
level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
564+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
565+
scenes_management::command::create_copy_scene(scenes_management_cluster);
566+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
548567

549568
return ESP_OK;
550569
}
@@ -1771,6 +1790,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
17711790
on_off::feature::lighting::add(on_off_cluster, &(config->on_off_lighting));
17721791
on_off::command::create_on(on_off_cluster);
17731792
on_off::command::create_toggle(on_off_cluster);
1793+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
1794+
scenes_management::command::create_copy_scene(scenes_management_cluster);
1795+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
17741796

17751797
return ESP_OK;
17761798
}
@@ -1808,6 +1830,9 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
18081830
cluster_t *level_control_cluster = level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER);
18091831
level_control::feature::lighting::add(level_control_cluster, &(config->level_control_lighting));
18101832
level_control::feature::on_off::add(level_control_cluster);
1833+
cluster_t *scenes_management_cluster = scenes_management::create(endpoint, &(config->scenes_management), CLUSTER_FLAG_SERVER);
1834+
scenes_management::command::create_copy_scene(scenes_management_cluster);
1835+
scenes_management::command::create_copy_scene_response(scenes_management_cluster);
18111836

18121837
return ESP_OK;
18131838
}

components/esp_matter/data_model/esp_matter_endpoint.h

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@
5454
#define ESP_MATTER_GENERIC_SWITCH_DEVICE_TYPE_VERSION 3
5555

5656
#define ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010A
57-
#define ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_VERSION 3
57+
#define ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_VERSION 4
5858
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010B
59-
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_VERSION 4
59+
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_VERSION 5
6060
#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID 0x010F
61-
#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION 1
61+
#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION 2
6262
#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID 0x0110
63-
#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION 1
63+
#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION 2
6464

6565
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302
6666
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_VERSION 2
@@ -77,21 +77,21 @@
7777
#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_ID 0x0307
7878
#define ESP_MATTER_HUMIDITY_SENSOR_DEVICE_TYPE_VERSION 2
7979
#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_ID 0x0072
80-
#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION 2
80+
#define ESP_MATTER_ROOM_AIR_CONDITIONER_DEVICE_TYPE_VERSION 3
8181
#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_ID 0x0070
8282
#define ESP_MATTER_REFRIGERATOR_DEVICE_TYPE_VERSION 2
8383
#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_ID 0x0071
84-
#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_VERSION 3
84+
#define ESP_MATTER_TEMPERATURE_CONTROLLED_CABINET_DEVICE_TYPE_VERSION 5
8585
#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_ID 0x0073
86-
#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_VERSION 1
86+
#define ESP_MATTER_LAUNDRY_WASHER_DEVICE_TYPE_VERSION 2
8787
#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_ID 0x0075
88-
#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_VERSION 1
88+
#define ESP_MATTER_DISH_WASHER_DEVICE_TYPE_VERSION 2
8989
#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_ID 0x0079
90-
#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_VERSION 1
90+
#define ESP_MATTER_MICROWAVE_OVEN_DEVICE_TYPE_VERSION 2
9191
#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_ID 0x0076
9292
#define ESP_MATTER_SMOKE_CO_ALARM_DEVICE_TYPE_VERSION 1
9393
#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_ID 0x007C
94-
#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_VERSION 1
94+
#define ESP_MATTER_LAUNDRY_DRYER_DEVICE_TYPE_VERSION 2
9595

9696
#define ESP_MATTER_FAN_DEVICE_TYPE_ID 0x002B
9797
#define ESP_MATTER_FAN_DEVICE_TYPE_VERSION 3
@@ -104,7 +104,7 @@
104104
#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID 0x000A
105105
#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_VERSION 3
106106
#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_ID 0x0202
107-
#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION 3
107+
#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION 4
108108
#define ESP_MATTER_PUMP_DEVICE_TYPE_ID 0x0303
109109
#define ESP_MATTER_PUMP_DEVICE_TYPE_VERSION 3
110110
#define ESP_MATTER_PUMP_CONTROLLER_DEVICE_TYPE_ID 0x0304
@@ -118,13 +118,13 @@
118118
#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID 0x0044
119119
#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1
120120
#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_ID 0x0077
121-
#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_VERSION 1
121+
#define ESP_MATTER_COOK_SURFACE_DEVICE_TYPE_VERSION 2
122122
#define ESP_MATTER_COOKTOP_DEVICE_TYPE_ID 0x0078
123123
#define ESP_MATTER_COOKTOP_DEVICE_TYPE_VERSION 1
124124
#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID 0x0510
125125
#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION 1
126126
#define ESP_MATTER_OVEN_DEVICE_TYPE_ID 0x007B
127-
#define ESP_MATTER_OVEN_DEVICE_TYPE_VERSION 1
127+
#define ESP_MATTER_OVEN_DEVICE_TYPE_VERSION 2
128128
#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_ID 0x0041
129129
#define ESP_MATTER_WATER_FREEZE_DETECTOR_DEVICE_TYPE_VERSION 1
130130
#define ESP_MATTER_ENERGY_EVSE_DEVICE_TYPE_ID 0x050C
@@ -142,10 +142,10 @@
142142
#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_ID 0x0017
143143
#define ESP_MATTER_SOLAR_POWER_DEVICE_TYPE_VERSION 1
144144
#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_ID 0x0018
145-
#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_VERSION 1
145+
#define ESP_MATTER_BATTERY_STORAGE_DEVICE_TYPE_VERSION 2
146146

147147
#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_ID 0x0091
148-
#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION 1
148+
#define ESP_MATTER_THREAD_BORDER_ROUTER_DEVICE_TYPE_VERSION 2
149149
#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_ID 0x0309
150150
#define ESP_MATTER_HEAT_PUMP_DEVICE_TYPE_VERSION 1
151151

@@ -177,12 +177,13 @@ typedef struct : app_base_config {
177177
typedef struct : app_with_group_config {
178178
cluster::on_off::config_t on_off;
179179
cluster::on_off::feature::lighting::config_t on_off_lighting;
180-
} on_off_config;
180+
cluster::scenes_management::config_t scenes_management;
181+
} on_off_with_lighting_config;
181182

182183
typedef struct : app_with_group_config {
183184
cluster::scenes_management::config_t scenes_management;
184185
cluster::on_off::config_t on_off;
185-
} on_off_with_scenes_management_config;
186+
} on_off_config;
186187

187188
typedef struct : app_base_config {
188189
cluster::boolean_state::config_t boolean_state;
@@ -251,7 +252,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
251252

252253
namespace on_off_light {
253254

254-
typedef struct config : on_off_config {
255+
typedef struct config : on_off_with_lighting_config {
255256
config() {
256257
/* For lighting product, the default identify type should be 0x01: LightOutput*/
257258
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kLightOutput);
@@ -293,7 +294,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
293294
namespace extended_color_light {
294295
typedef struct config : dimmable_light::config_t {
295296
cluster::color_control::config_t color_control;
296-
cluster::scenes_management::config_t scenes_management;
297297
cluster::color_control::feature::color_temperature::config_t color_control_color_temperature;
298298
cluster::color_control::feature::xy::config_t color_control_xy;
299299
uint16_t color_control_remaining_time;
@@ -365,7 +365,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
365365

366366
namespace on_off_plugin_unit {
367367

368-
typedef struct config : on_off_config {
368+
typedef struct config : on_off_with_lighting_config {
369369
config() {
370370
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kVisibleIndicator);
371371
}
@@ -536,7 +536,6 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
536536

537537
namespace window_covering_device {
538538
typedef struct config : app_with_group_config {
539-
cluster::scenes_management::config_t scenes_management;
540539
cluster::window_covering::config_t window_covering;
541540
config(uint8_t end_product_type = 0) : window_covering(end_product_type) {
542541
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
@@ -925,7 +924,7 @@ esp_err_t add(endpoint_t *endpoint, config_t *config);
925924
} /* secondary_network_interface */
926925

927926
namespace mounted_on_off_control {
928-
typedef struct config : on_off_config {
927+
typedef struct config : on_off_with_lighting_config {
929928
config() {
930929
identify.identify_type = chip::to_underlying(chip::app::Clusters::Identify::IdentifyTypeEnum::kActuator);
931930
}

0 commit comments

Comments
 (0)