Skip to content

Commit cc635e2

Browse files
committed
Merge branch 'thermostat/add-feature' into 'main'
Add LocalTemperatureNotExposed feature support to thermostat See merge request app-frameworks/esp-matter!715
2 parents 05d3894 + c47b98b commit cc635e2

File tree

4 files changed

+57
-19
lines changed

4 files changed

+57
-19
lines changed

components/esp_matter/esp_matter_cluster.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,21 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
15871587
if (features & feature::cooling::get_id()) {
15881588
feature::cooling::add(cluster, &(config->cooling));
15891589
}
1590-
1590+
if (features & feature::setback::get_id()) {
1591+
feature::setback::add(cluster, &(config->setback));
1592+
}
1593+
if (features & feature::occupancy::get_id()) {
1594+
feature::occupancy::add(cluster, &(config->occupancy));
1595+
}
1596+
if (features & feature::schedule_configuration::get_id()) {
1597+
feature::schedule_configuration::add(cluster, &(config->schedule_configuration));
1598+
}
1599+
if (features & feature::auto_mode::get_id()) {
1600+
feature::auto_mode::add(cluster, &(config->auto_mode));
1601+
}
1602+
if (features & feature::local_temperature_not_exposed::get_id()) {
1603+
feature::local_temperature_not_exposed::add(cluster, &(config->local_temperature_not_exposed));
1604+
}
15911605
return cluster;
15921606
}
15931607
} /* thermostat */

components/esp_matter/esp_matter_cluster.h

+5
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,11 @@ typedef struct config {
377377
uint8_t system_mode;
378378
feature::heating::config_t heating;
379379
feature::cooling::config_t cooling;
380+
feature::occupancy::config_t occupancy;
381+
feature::setback::config_t setback;
382+
feature::schedule_configuration::config_t schedule_configuration;
383+
feature::auto_mode::config_t auto_mode;
384+
feature::local_temperature_not_exposed::config_t local_temperature_not_exposed;
380385
config() : cluster_revision(6), local_temperature(), control_sequence_of_operation(4), system_mode(1) {}
381386
} config_t;
382387

components/esp_matter/esp_matter_feature.cpp

+25-18
Original file line numberDiff line numberDiff line change
@@ -2768,9 +2768,7 @@ namespace heating {
27682768

27692769
uint32_t get_id()
27702770
{
2771-
// The ThermostatFeature enum class is not added in the upstream code.
2772-
// Return the code according to the SPEC
2773-
return 0x01;
2771+
return (uint32_t)Thermostat::Feature::kHeating;
27742772
}
27752773

27762774
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2792,9 +2790,7 @@ namespace cooling {
27922790

27932791
uint32_t get_id()
27942792
{
2795-
// The ThermostatFeature enum class is not added in the upstream code.
2796-
// Return the code according to the SPEC
2797-
return 0x02;
2793+
return (uint32_t)Thermostat::Feature::kCooling;
27982794
}
27992795

28002796
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2816,9 +2812,7 @@ namespace occupancy {
28162812

28172813
uint32_t get_id()
28182814
{
2819-
// The ThermostatFeature enum class is not added in the upstream code.
2820-
// Return the code according to the SPEC
2821-
return 0x04;
2815+
return (uint32_t)Thermostat::Feature::kOccupancy;
28222816
}
28232817

28242818
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2858,9 +2852,7 @@ namespace schedule_configuration {
28582852

28592853
uint32_t get_id()
28602854
{
2861-
// The ThermostatFeature enum class is not added in the upstream code.
2862-
// Return the code according to the SPEC
2863-
return 0x08;
2855+
return (uint32_t)Thermostat::Feature::kScheduleConfiguration;
28642856
}
28652857

28662858
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2888,9 +2880,7 @@ namespace setback {
28882880

28892881
uint32_t get_id()
28902882
{
2891-
// The ThermostatFeature enum class is not added in the upstream code.
2892-
// Return the code according to the SPEC
2893-
return 0x10;
2883+
return (uint32_t)Thermostat::Feature::kSetback;
28942884
}
28952885

28962886
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2913,9 +2903,7 @@ namespace auto_mode {
29132903

29142904
uint32_t get_id()
29152905
{
2916-
// The ThermostatFeature enum class is not added in the upstream code.
2917-
// Return the code according to the SPEC
2918-
return 0x20;
2906+
return (uint32_t)Thermostat::Feature::kAutoMode;
29192907
}
29202908

29212909
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2932,6 +2920,25 @@ esp_err_t add(cluster_t *cluster, config_t *config)
29322920
}
29332921
} /* auto_mode */
29342922

2923+
namespace local_temperature_not_exposed {
2924+
2925+
uint32_t get_id()
2926+
{
2927+
return (uint32_t)Thermostat::Feature::kLocalTemperatureNotExposed;
2928+
}
2929+
2930+
esp_err_t add(cluster_t *cluster, config_t *config)
2931+
{
2932+
if (!cluster) {
2933+
ESP_LOGE(TAG, "Cluster cannot be NULL");
2934+
return ESP_ERR_INVALID_ARG;
2935+
}
2936+
update_feature_map(cluster, get_id());
2937+
2938+
return ESP_OK;
2939+
}
2940+
} /* local_temperature_not_exposed */
2941+
29352942
} /* feature */
29362943
} /* thermostat */
29372944

components/esp_matter/esp_matter_feature.h

+12
Original file line numberDiff line numberDiff line change
@@ -560,6 +560,18 @@ uint32_t get_id();
560560
esp_err_t add(cluster_t *cluster, config_t *config);
561561
} /* auto_mode */
562562

563+
namespace local_temperature_not_exposed {
564+
565+
typedef struct config {
566+
int16_t local_temperature_calibration;
567+
568+
config (): local_temperature_calibration(0) {}
569+
} config_t;
570+
571+
uint32_t get_id();
572+
esp_err_t add(cluster_t *cluster, config_t *config);
573+
} /* local_temperature_not_exposed */
574+
563575
} /* feature */
564576
} /* thermostat */
565577

0 commit comments

Comments
 (0)