From 96ab773bbc94f6ce083d341c32198e46553c4789 Mon Sep 17 00:00:00 2001 From: Mahesh Pimpale Date: Fri, 27 Feb 2026 17:18:00 +0530 Subject: [PATCH] components/esp_matter: Add irrigation system device type data model --- .../data_model/esp_matter_endpoint.cpp | 24 +++++++++++++++++++ .../data_model/esp_matter_endpoint.h | 13 ++++++++++ .../all_device_types_app/main/device_types.h | 2 ++ .../main/esp_matter_console_helpers.cpp | 9 +++++++ 4 files changed, 48 insertions(+) diff --git a/components/esp_matter/data_model/esp_matter_endpoint.cpp b/components/esp_matter/data_model/esp_matter_endpoint.cpp index c8a611af1..8959bcfb2 100644 --- a/components/esp_matter/data_model/esp_matter_endpoint.cpp +++ b/components/esp_matter/data_model/esp_matter_endpoint.cpp @@ -2300,6 +2300,30 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) return ESP_OK; } } /* soil_sensor */ + +namespace irrigation_system { +uint32_t get_device_type_id() +{ + return ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + return common::create(node, config, flags, priv_data, add); +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + VerifyOrReturnError(err == ESP_OK, err); + return ESP_OK; +} +} /* irrigation_system */ } /* endpoint */ namespace node { diff --git a/components/esp_matter/data_model/esp_matter_endpoint.h b/components/esp_matter/data_model/esp_matter_endpoint.h index 5abf5589b..c516ba960 100644 --- a/components/esp_matter/data_model/esp_matter_endpoint.h +++ b/components/esp_matter/data_model/esp_matter_endpoint.h @@ -169,6 +169,8 @@ #define ESP_MATTER_ELECTRICAL_METER_DEVICE_TYPE_VERSION 1 #define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_ID 0x0045 #define ESP_MATTER_SOIL_SENSOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_ID 0x0040 +#define ESP_MATTER_IRRIGATION_SYSTEM_DEVICE_TYPE_VERSION 1 namespace esp_matter { @@ -1194,6 +1196,17 @@ uint8_t get_device_type_version(); endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); esp_err_t add(endpoint_t *endpoint, config_t *config); } /* soil_sensor */ + +namespace irrigation_system { +typedef struct config { + cluster::descriptor::config_t descriptor; +} config_t; + +uint32_t get_device_type_id(); +uint8_t get_device_type_version(); +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data); +esp_err_t add(endpoint_t *endpoint, config_t *config); +} } /* endpoint */ namespace node { diff --git a/examples/all_device_types_app/main/device_types.h b/examples/all_device_types_app/main/device_types.h index 2c9ba41c1..678f110f8 100644 --- a/examples/all_device_types_app/main/device_types.h +++ b/examples/all_device_types_app/main/device_types.h @@ -68,6 +68,7 @@ enum device_type_enum { ESP_MATTER_ELECTRICAL_METER, ESP_MATTER_ELECTRICAL_UTILITY_METER, ESP_MATTER_SOIL_SENSOR, + ESP_MATTER_IRRIGATION_SYSTEM, ESP_MATTER_DEVICE_TYPE_MAX }; @@ -142,5 +143,6 @@ const device_type_name device_type_list[ESP_MATTER_DEVICE_TYPE_MAX] = { {"electrical_meter", ESP_MATTER_ELECTRICAL_METER}, {"electrical_utility_meter", ESP_MATTER_ELECTRICAL_UTILITY_METER}, {"soil_sensor", ESP_MATTER_SOIL_SENSOR}, + {"irrigation_system", ESP_MATTER_IRRIGATION_SYSTEM}, }; } /* namespace esp_matter */ diff --git a/examples/all_device_types_app/main/esp_matter_console_helpers.cpp b/examples/all_device_types_app/main/esp_matter_console_helpers.cpp index f58888014..8e8d37f7a 100644 --- a/examples/all_device_types_app/main/esp_matter_console_helpers.cpp +++ b/examples/all_device_types_app/main/esp_matter_console_helpers.cpp @@ -743,6 +743,15 @@ int create(uint8_t device_type_index) chip::app::Clusters::SoilMeasurement::SetSoilMoistureLimits(esp_matter::endpoint::get_id(endpoint), limits); break; } + case ESP_MATTER_IRRIGATION_SYSTEM: { + esp_matter::endpoint::irrigation_system::config_t irrigation_system_config; + endpoint = esp_matter::endpoint::irrigation_system::create(node, &irrigation_system_config, ENDPOINT_FLAG_NONE, NULL); + + esp_matter::endpoint::water_valve::config_t water_valve_config; + esp_err_t err = esp_matter::endpoint::water_valve::add(endpoint, &water_valve_config); + VerifyOrReturnValue(err == ESP_OK, 1, ESP_LOGE(TAG, "Failed to add water valve endpoint")); + break; + } default: { ESP_LOGE(TAG, "Please input a valid device type"); break;