Merge branch 'thermostat/add-feature' into 'main'

Add LocalTemperatureNotExposed feature support to thermostat

See merge request app-frameworks/esp-matter!715
This commit is contained in:
Hrishikesh Dhayagude
2024-04-26 18:19:06 +08:00
4 changed files with 57 additions and 19 deletions
+15 -1
View File
@@ -1587,7 +1587,21 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
if (features & feature::cooling::get_id()) {
feature::cooling::add(cluster, &(config->cooling));
}
if (features & feature::setback::get_id()) {
feature::setback::add(cluster, &(config->setback));
}
if (features & feature::occupancy::get_id()) {
feature::occupancy::add(cluster, &(config->occupancy));
}
if (features & feature::schedule_configuration::get_id()) {
feature::schedule_configuration::add(cluster, &(config->schedule_configuration));
}
if (features & feature::auto_mode::get_id()) {
feature::auto_mode::add(cluster, &(config->auto_mode));
}
if (features & feature::local_temperature_not_exposed::get_id()) {
feature::local_temperature_not_exposed::add(cluster, &(config->local_temperature_not_exposed));
}
return cluster;
}
} /* thermostat */
@@ -377,6 +377,11 @@ typedef struct config {
uint8_t system_mode;
feature::heating::config_t heating;
feature::cooling::config_t cooling;
feature::occupancy::config_t occupancy;
feature::setback::config_t setback;
feature::schedule_configuration::config_t schedule_configuration;
feature::auto_mode::config_t auto_mode;
feature::local_temperature_not_exposed::config_t local_temperature_not_exposed;
config() : cluster_revision(6), local_temperature(), control_sequence_of_operation(4), system_mode(1) {}
} config_t;
+25 -18
View File
@@ -2768,9 +2768,7 @@ namespace heating {
uint32_t get_id()
{
// The ThermostatFeature enum class is not added in the upstream code.
// Return the code according to the SPEC
return 0x01;
return (uint32_t)Thermostat::Feature::kHeating;
}
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2792,9 +2790,7 @@ namespace cooling {
uint32_t get_id()
{
// The ThermostatFeature enum class is not added in the upstream code.
// Return the code according to the SPEC
return 0x02;
return (uint32_t)Thermostat::Feature::kCooling;
}
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2816,9 +2812,7 @@ namespace occupancy {
uint32_t get_id()
{
// The ThermostatFeature enum class is not added in the upstream code.
// Return the code according to the SPEC
return 0x04;
return (uint32_t)Thermostat::Feature::kOccupancy;
}
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2858,9 +2852,7 @@ namespace schedule_configuration {
uint32_t get_id()
{
// The ThermostatFeature enum class is not added in the upstream code.
// Return the code according to the SPEC
return 0x08;
return (uint32_t)Thermostat::Feature::kScheduleConfiguration;
}
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2888,9 +2880,7 @@ namespace setback {
uint32_t get_id()
{
// The ThermostatFeature enum class is not added in the upstream code.
// Return the code according to the SPEC
return 0x10;
return (uint32_t)Thermostat::Feature::kSetback;
}
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2913,9 +2903,7 @@ namespace auto_mode {
uint32_t get_id()
{
// The ThermostatFeature enum class is not added in the upstream code.
// Return the code according to the SPEC
return 0x20;
return (uint32_t)Thermostat::Feature::kAutoMode;
}
esp_err_t add(cluster_t *cluster, config_t *config)
@@ -2932,6 +2920,25 @@ esp_err_t add(cluster_t *cluster, config_t *config)
}
} /* auto_mode */
namespace local_temperature_not_exposed {
uint32_t get_id()
{
return (uint32_t)Thermostat::Feature::kLocalTemperatureNotExposed;
}
esp_err_t add(cluster_t *cluster, config_t *config)
{
if (!cluster) {
ESP_LOGE(TAG, "Cluster cannot be NULL");
return ESP_ERR_INVALID_ARG;
}
update_feature_map(cluster, get_id());
return ESP_OK;
}
} /* local_temperature_not_exposed */
} /* feature */
} /* thermostat */
@@ -560,6 +560,18 @@ uint32_t get_id();
esp_err_t add(cluster_t *cluster, config_t *config);
} /* auto_mode */
namespace local_temperature_not_exposed {
typedef struct config {
int16_t local_temperature_calibration;
config (): local_temperature_calibration(0) {}
} config_t;
uint32_t get_id();
esp_err_t add(cluster_t *cluster, config_t *config);
} /* local_temperature_not_exposed */
} /* feature */
} /* thermostat */