mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
bugfix: Add nonvolatile attribute initializing for on_off cluster
This commit is contained in:
@@ -658,7 +658,7 @@ namespace attribute {
|
||||
|
||||
attribute_t *create_on_off(cluster_t *cluster, bool value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, OnOff::Attributes::OnOff::Id, ATTRIBUTE_FLAG_NONE,
|
||||
return esp_matter::attribute::create(cluster, OnOff::Attributes::OnOff::Id, ATTRIBUTE_FLAG_NONVOLATILE,
|
||||
esp_matter_bool(value));
|
||||
}
|
||||
|
||||
@@ -682,8 +682,8 @@ attribute_t *create_off_wait_time(cluster_t *cluster, uint16_t value)
|
||||
|
||||
attribute_t *create_start_up_on_off(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, OnOff::Attributes::StartUpOnOff::Id, ATTRIBUTE_FLAG_WRITABLE,
|
||||
esp_matter_enum8(value));
|
||||
return esp_matter::attribute::create(cluster, OnOff::Attributes::StartUpOnOff::Id,
|
||||
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value));
|
||||
}
|
||||
|
||||
} /* attribute */
|
||||
|
||||
@@ -1045,6 +1045,8 @@ esp_err_t store_val_in_nvs(attribute_t *attribute)
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
ESP_LOGI(TAG, "strore attribute in nvs: endpoint_id-0x%x, cluster_id-0x%x, attribute_id-0x%x",
|
||||
endpoint_id, cluster_id, attribute_id);
|
||||
if (current_attribute->val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
|
||||
current_attribute->val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
|
||||
current_attribute->val.type == ESP_MATTER_VAL_TYPE_ARRAY) {
|
||||
@@ -1085,6 +1087,8 @@ esp_err_t get_val_from_nvs(attribute_t *attribute, esp_matter_attr_val_t *val)
|
||||
if (err != ESP_OK) {
|
||||
return err;
|
||||
}
|
||||
ESP_LOGI(TAG, "read attribute from nvs: endpoint_id-0x%x, cluster_id-0x%x, attribute_id-0x%x",
|
||||
endpoint_id, cluster_id, attribute_id);
|
||||
if (current_attribute->val.type == ESP_MATTER_VAL_TYPE_CHAR_STRING ||
|
||||
current_attribute->val.type == ESP_MATTER_VAL_TYPE_OCTET_STRING ||
|
||||
current_attribute->val.type == ESP_MATTER_VAL_TYPE_ARRAY) {
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace lighting {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::OnOff::OnOffFeature::kLighting;
|
||||
return (uint32_t)OnOff::OnOffFeature::kLighting;
|
||||
}
|
||||
|
||||
esp_err_t add(cluster_t *cluster, config_t *config)
|
||||
@@ -95,7 +95,7 @@ namespace on_off {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::LevelControl::LevelControlFeature::kOnOff;
|
||||
return (uint32_t)LevelControl::LevelControlFeature::kOnOff;
|
||||
}
|
||||
|
||||
esp_err_t add(cluster_t *cluster)
|
||||
@@ -115,7 +115,7 @@ namespace lighting {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::LevelControl::LevelControlFeature::kLighting;
|
||||
return (uint32_t)LevelControl::LevelControlFeature::kLighting;
|
||||
}
|
||||
|
||||
esp_err_t add(cluster_t *cluster, config_t *config)
|
||||
@@ -145,7 +145,7 @@ namespace hue_saturation {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::ColorControl::ColorCapabilities::kHueSaturationSupported;
|
||||
return (uint32_t)ColorControl::ColorCapabilities::kHueSaturationSupported;
|
||||
}
|
||||
|
||||
esp_err_t add(cluster_t *cluster, config_t *config)
|
||||
@@ -179,7 +179,7 @@ namespace color_temperature {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::ColorControl::ColorCapabilities::kColorTemperatureSupported;
|
||||
return (uint32_t)ColorControl::ColorCapabilities::kColorTemperatureSupported;
|
||||
}
|
||||
|
||||
esp_err_t add(cluster_t *cluster, config_t *config)
|
||||
@@ -212,7 +212,7 @@ namespace xy {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::ColorControl::ColorCapabilities::kXYAttributesSupported;
|
||||
return (uint32_t)ColorControl::ColorCapabilities::kXYAttributesSupported;
|
||||
}
|
||||
|
||||
esp_err_t add(cluster_t *cluster, config_t *config)
|
||||
|
||||
Reference in New Issue
Block a user