Skip to content

Commit 5a9bc09

Browse files
committed
Merge branch 'add_bounds_of_thermostat_user_interface_configuration_cluster' into 'release/v1.3'
components/esp-matter:add bounds of thermostat user interface configuration cluster See merge request app-frameworks/esp-matter!961
2 parents fb4e604 + 5973dbd commit 5a9bc09

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

components/esp_matter/esp_matter_attribute.cpp

+30-9
Original file line numberDiff line numberDiff line change
@@ -1997,22 +1997,43 @@ attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value)
19971997
namespace thermostat_user_interface_configuration {
19981998
namespace attribute {
19991999

2000-
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value)
2000+
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
20012001
{
2002-
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id,
2003-
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
2002+
attribute_t *attribute =
2003+
esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::TemperatureDisplayMode::Id,
2004+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
2005+
if (!attribute) {
2006+
ESP_LOGE(TAG, "Could not create attribute");
2007+
return NULL;
2008+
}
2009+
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
2010+
return attribute;
20042011
}
20052012

2006-
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value)
2013+
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
20072014
{
2008-
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id,
2009-
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
2015+
attribute_t *attribute =
2016+
esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::KeypadLockout::Id,
2017+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
2018+
if (!attribute) {
2019+
ESP_LOGE(TAG, "Could not create attribute");
2020+
return NULL;
2021+
}
2022+
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
2023+
return attribute;
20102024
}
20112025

2012-
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value)
2026+
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value, uint8_t min, uint8_t max)
20132027
{
2014-
return esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id,
2015-
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
2028+
attribute_t *attribute =
2029+
esp_matter::attribute::create(cluster, ThermostatUserInterfaceConfiguration::Attributes::ScheduleProgrammingVisibility::Id,
2030+
ATTRIBUTE_FLAG_WRITABLE, esp_matter_enum8(value));
2031+
if (!attribute) {
2032+
ESP_LOGE(TAG, "Could not create attribute");
2033+
return NULL;
2034+
}
2035+
esp_matter::attribute::add_bounds(attribute, esp_matter_uint8(min), esp_matter_uint8(max));
2036+
return attribute;
20162037
}
20172038

20182039
} /* attribute */

components/esp_matter/esp_matter_attribute.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -446,9 +446,9 @@ attribute_t *create_ac_capacity_format(cluster_t *cluster, uint8_t value);
446446

447447
namespace thermostat_user_interface_configuration {
448448
namespace attribute {
449-
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value);
450-
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value);
451-
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value);
449+
attribute_t *create_temperature_display_mode(cluster_t *cluster, uint8_t value, uint8_t min = 0, uint8_t max = 1);
450+
attribute_t *create_keypad_lockout(cluster_t *cluster, uint8_t value, uint8_t min = 0, uint8_t max = 5);
451+
attribute_t *create_schedule_programming_visibility(cluster_t *cluster, uint8_t value, uint8_t min = 0, uint8_t max = 1);
452452
} /* attribute */
453453
} /* thermostat_user_interface_configuration */
454454

0 commit comments

Comments
 (0)