Skip to content

Commit

Permalink
Merge branch 'add_bounds_of_thermostat_user_interface_configuration_c…
Browse files Browse the repository at this point in the history
…luster' into 'release/v1.3'

components/esp-matter:add bounds of thermostat user interface configuration cluster

See merge request app-frameworks/esp-matter!961
  • Loading branch information
chshu committed Dec 16, 2024
2 parents fb4e604 + 5973dbd commit 5a9bc09
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 12 deletions.
39 changes: 30 additions & 9 deletions components/esp_matter/esp_matter_attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1997,22 +1997,43 @@ attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value)
namespace thermostat_user_interface_configuration {
namespace attribute {

attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value)
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
{
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
attribute_t *attribute =
esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
if (!attribute) {
ESP_LOGE(TAG, "Could not create attribute");
return NULL;
}
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
return attribute;
}

attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value)
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
{
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
attribute_t *attribute =
esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
if (!attribute) {
ESP_LOGE(TAG, "Could not create attribute");
return NULL;
}
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
return attribute;
}

attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value)
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
{
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
attribute_t *attribute =
esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id,
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
if (!attribute) {
ESP_LOGE(TAG, "Could not create attribute");
return NULL;
}
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
return attribute;
}

} /* attribute */
Expand Down
6 changes: 3 additions & 3 deletions components/esp_matter/esp_matter_attribute.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,9 @@ attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value);

namespace thermostat_user_interface_configuration {
namespace attribute {
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value);
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value);
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value);
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value, uint8_t min = 0, uint8_t max = 1);
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value, uint8_t min = 0, uint8_t max = 5);
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value, uint8_t min = 0, uint8_t max = 1);
} /* attribute */
} /* thermostat_user_interface_configuration */

Expand Down

0 comments on commit 5a9bc09

Please sign in to comment.