mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'feat/irrigation_system_device_type' into 'main'
Add irrigation system device type data model See merge request app-frameworks/esp-matter!1445
This commit is contained in:
@@ -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<config_t>(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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user