From b3f5a9aa53059d27f5f65ace8ec1374a44a0a114 Mon Sep 17 00:00:00 2001 From: Rohit Jadhav Date: Mon, 11 Mar 2024 15:49:16 +0530 Subject: [PATCH] Add Rain Sensor device type --- .../esp_matter/esp_matter_attribute.cpp | 55 +++++++++- components/esp_matter/esp_matter_attribute.h | 15 ++- components/esp_matter/esp_matter_cluster.cpp | 56 +++++++++- components/esp_matter/esp_matter_cluster.h | 13 +++ components/esp_matter/esp_matter_command.cpp | 35 ++++++ components/esp_matter/esp_matter_command.h | 7 ++ components/esp_matter/esp_matter_endpoint.cpp | 39 +++++++ components/esp_matter/esp_matter_endpoint.h | 15 +++ components/esp_matter/esp_matter_event.cpp | 16 +++ components/esp_matter/esp_matter_event.h | 7 ++ components/esp_matter/esp_matter_feature.cpp | 103 ++++++++++++++++++ components/esp_matter/esp_matter_feature.h | 52 +++++++++ .../app/PluginApplicationCallbacks.h | 1 + .../all_device_types_app/main/device_types.h | 4 +- .../main/esp_matter_console_helpers.cpp | 5 + 15 files changed, 419 insertions(+), 4 deletions(-) diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index 8316ba489..7cb96b2e8 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -3316,7 +3316,7 @@ attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t val namespace boolean_state { namespace attribute { -attribute_t *state_value(cluster_t *cluster, bool value) +attribute_t *create_state_value(cluster_t *cluster, bool value) { return esp_matter::attribute::create(cluster, BooleanState::Attributes::StateValue::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bool(value)); @@ -3325,6 +3325,59 @@ attribute_t *state_value(cluster_t *cluster, bool value) } /* attribute */ } /* boolean_state */ +namespace boolean_state_configuration { +namespace attribute { +attribute_t *create_current_sensitivity_level(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::CurrentSensitivityLevel::Id, ATTRIBUTE_FLAG_NONVOLATILE, + esp_matter_uint8(value)); +} + +attribute_t *create_supported_sensitivity_levels(cluster_t *cluster, const uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::SupportedSensitivityLevels::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint8(value)); +} + +attribute_t *create_default_sensitivity_level(cluster_t *cluster, const uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::DefaultSensitivityLevel::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_uint8(value)); +} + +attribute_t *create_alarms_active(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::AlarmsActive::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_bitmap8(value)); +} + +attribute_t *create_alarms_suppressed(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::AlarmsSuppressed::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_bitmap8(value)); +} + +attribute_t *create_alarms_enabled(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::AlarmsEnabled::Id, ATTRIBUTE_FLAG_NONVOLATILE, + esp_matter_bitmap8(value)); +} + +attribute_t *create_alarms_supported(cluster_t *cluster, const uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::AlarmsSupported::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_bitmap8(value)); +} + +attribute_t *create_sensor_fault(cluster_t *cluster, uint8_t value) +{ + return esp_matter::attribute::create(cluster, BooleanStateConfiguration::Attributes::SensorFault::Id, ATTRIBUTE_FLAG_NONE, + esp_matter_bitmap8(value)); +} + +} /* attribute */ +} /* boolean_state_configuration */ + namespace localization_configuration { namespace attribute { diff --git a/components/esp_matter/esp_matter_attribute.h b/components/esp_matter/esp_matter_attribute.h index dff42b3eb..d80fc06a1 100644 --- a/components/esp_matter/esp_matter_attribute.h +++ b/components/esp_matter/esp_matter_attribute.h @@ -762,10 +762,23 @@ attribute_t *create_occupancy_sensor_type_bitmap(cluster_t *cluster, uint8_t val namespace boolean_state { namespace attribute { -attribute_t *state_value(cluster_t *cluster, bool value); +attribute_t *create_state_value(cluster_t *cluster, bool value); } /* attribute */ } /* boolean_state */ +namespace boolean_state_configuration { +namespace attribute { +attribute_t *create_current_sensitivity_level(cluster_t *cluster, uint8_t value); +attribute_t *create_supported_sensitivity_levels(cluster_t *cluster, const uint8_t value); +attribute_t *create_default_sensitivity_level(cluster_t *cluster, const uint8_t value); +attribute_t *create_alarms_active(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_suppressed(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_enabled(cluster_t *cluster, uint8_t value); +attribute_t *create_alarms_supported(cluster_t *cluster, const uint8_t value); +attribute_t *create_sensor_fault(cluster_t *cluster, uint8_t value); +} /* attribute */ +} /* boolean_state_configuration */ + namespace localization_configuration { constexpr uint8_t k_max_active_locale_length = 35; diff --git a/components/esp_matter/esp_matter_cluster.cpp b/components/esp_matter/esp_matter_cluster.cpp index c5f0e2242..a4b421b94 100644 --- a/components/esp_matter/esp_matter_cluster.cpp +++ b/components/esp_matter/esp_matter_cluster.cpp @@ -2664,7 +2664,7 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) /* Attributes not managed internally */ if (config) { global::attribute::create_cluster_revision(cluster, config->cluster_revision); - attribute::state_value(cluster, config->state_value); + attribute::create_state_value(cluster, config->state_value); } else { ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes."); } @@ -2674,6 +2674,60 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags) } } /* boolean_state */ +namespace boolean_state_configuration { +const function_generic_t *function_list = NULL; +const int function_flags = CLUSTER_FLAG_NONE; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features) +{ + cluster_t *cluster = cluster::create(endpoint, BooleanStateConfiguration::Id, flags); + if (!cluster) { + ESP_LOGE(TAG, "Could not create cluster"); + return NULL; + } + + if (flags & CLUSTER_FLAG_SERVER) { + static const auto plugin_server_init_cb = CALL_ONCE(MatterBooleanStateConfigurationPluginServerInitCallback); + set_plugin_server_init_callback(cluster, plugin_server_init_cb); + add_function_list(cluster, function_list, function_flags); + } + if (flags & CLUSTER_FLAG_CLIENT) { + create_default_binding_cluster(endpoint); + } + + if (flags & CLUSTER_FLAG_SERVER) { + /* Attributes managed internally */ + global::attribute::create_feature_map(cluster, 0); +#if CHIP_CONFIG_ENABLE_EVENTLIST_ATTRIBUTE + global::attribute::create_event_list(cluster, NULL, 0, 0); +#endif + + /* Attributes not managed internally */ + if (config) { + global::attribute::create_cluster_revision(cluster, config->cluster_revision); + } else { + ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes."); + } + } + + + /* Features */ + if (features & feature::visual::get_id()) { + feature::visual::add(cluster, &(config->visual)); + } + if (features & feature::audible::get_id()) { + feature::audible::add(cluster, &(config->audible)); + } + if (features & feature::alarm_suppress::get_id()) { + feature::alarm_suppress::add(cluster, &(config->alarm_suppress)); + } + if (features & feature::sensitivity_level::get_id()) { + feature::sensitivity_level::add(cluster, &(config->sensitivity_level)); + } + return cluster; +} +} /* boolean_state_configuration */ + namespace localization_configuration { const function_generic_t function_list[] = { (function_generic_t)emberAfLocalizationConfigurationClusterServerInitCallback, diff --git a/components/esp_matter/esp_matter_cluster.h b/components/esp_matter/esp_matter_cluster.h index d0910db70..0471cf381 100644 --- a/components/esp_matter/esp_matter_cluster.h +++ b/components/esp_matter/esp_matter_cluster.h @@ -625,6 +625,19 @@ typedef struct config { cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags); } /* boolean_state */ +namespace boolean_state_configuration { +typedef struct config { + uint16_t cluster_revision; + feature::visual::config_t visual; + feature::audible::config_t audible; + feature::alarm_suppress::config_t alarm_suppress; + feature::sensitivity_level::config_t sensitivity_level; + config() : cluster_revision(1) {} +} config_t; + +cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_t features); +} /* boolean_state */ + namespace localization_configuration { typedef struct config { uint16_t cluster_revision; diff --git a/components/esp_matter/esp_matter_command.cpp b/components/esp_matter/esp_matter_command.cpp index 01d4f6f70..86fc110c6 100644 --- a/components/esp_matter/esp_matter_command.cpp +++ b/components/esp_matter/esp_matter_command.cpp @@ -1248,6 +1248,26 @@ static esp_err_t esp_matter_command_callback_send_key(const ConcreteCommandPath return ESP_OK; } +static esp_err_t esp_matter_command_callback_suppress_alarm(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) +{ + chip::app::Clusters::BooleanStateConfiguration::Commands::SuppressAlarm::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfBooleanStateConfigurationClusterSuppressAlarmCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + +static esp_err_t esp_matter_command_callback_enable_disable_alarm(const ConcreteCommandPath &command_path, TLVReader &tlv_data, void *opaque_ptr) +{ + chip::app::Clusters::BooleanStateConfiguration::Commands::EnableDisableAlarm::DecodableType command_data; + CHIP_ERROR error = Decode(tlv_data, command_data); + if (error == CHIP_NO_ERROR) { + emberAfBooleanStateConfigurationClusterEnableDisableAlarmCallback((CommandHandler *)opaque_ptr, command_path, command_data); + } + return ESP_OK; +} + namespace esp_matter { namespace cluster { @@ -2381,6 +2401,21 @@ command_t *create_send_key_response(cluster_t *cluster) } /* command */ } /* keypad_input */ +namespace boolean_state_configuration { +namespace command { +command_t *create_suppress_alarm(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, BooleanStateConfiguration::Commands::SuppressAlarm::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_suppress_alarm); +} + +command_t *create_enable_disable_alarm(cluster_t *cluster) +{ + return esp_matter::command::create(cluster, BooleanStateConfiguration::Commands::EnableDisableAlarm::Id, COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_enable_disable_alarm); +} + +} /* command */ +} /* boolean_state_configuration */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/esp_matter_command.h b/components/esp_matter/esp_matter_command.h index 6ae82d724..1f1a3af04 100644 --- a/components/esp_matter/esp_matter_command.h +++ b/components/esp_matter/esp_matter_command.h @@ -364,5 +364,12 @@ command_t *create_send_key_response(cluster_t *cluster); } /* command */ } /* keypad_input */ +namespace boolean_state_configuration { +namespace command { +command_t *create_suppress_alarm(cluster_t *cluster); +command_t *create_enable_disable_alarm(cluster_t *cluster); +} /* command */ +} /* boolean_state_configuration */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/esp_matter_endpoint.cpp b/components/esp_matter/esp_matter_endpoint.cpp index 3ae70db3f..02e8d7cc9 100644 --- a/components/esp_matter/esp_matter_endpoint.cpp +++ b/components/esp_matter/esp_matter_endpoint.cpp @@ -1516,6 +1516,45 @@ esp_err_t add(endpoint_t *endpoint, config_t *config) } } /* water_leak_detector */ +namespace rain_sensor { +uint32_t get_device_type_id() +{ + return ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID; +} + +uint8_t get_device_type_version() +{ + return ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION; +} + +endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_data) +{ + endpoint_t *endpoint = endpoint::create(node, flags, priv_data); + add(endpoint, config); + return endpoint; +} + +esp_err_t add(endpoint_t *endpoint, config_t *config) +{ + if (!endpoint) { + ESP_LOGE(TAG, "Endpoint cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + esp_err_t err = add_device_type(endpoint, get_device_type_id(), get_device_type_version()); + if (err != ESP_OK) { + ESP_LOGE(TAG, "Failed to add device type id:%" PRIu32 ",err: %d", get_device_type_id(), err); + return err; + } + + descriptor::create(endpoint, &(config->descriptor), CLUSTER_FLAG_SERVER); + identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER); + cluster_t *cluster = boolean_state::create(endpoint, &(config->boolean_state), CLUSTER_FLAG_SERVER); + + boolean_state::event::create_state_change(cluster); + return ESP_OK; +} +} /* rain_sensor */ + } /* endpoint */ namespace node { diff --git a/components/esp_matter/esp_matter_endpoint.h b/components/esp_matter/esp_matter_endpoint.h index a29327a1e..eeb944db4 100644 --- a/components/esp_matter/esp_matter_endpoint.h +++ b/components/esp_matter/esp_matter_endpoint.h @@ -98,6 +98,8 @@ #define ESP_MATTER_ROBOTIC_VACCUM_CLEANER_DEVICE_TYPE_VERSION 1 #define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_ID 0x0043 #define ESP_MATTER_WATER_LEAK_DETECTOR_DEVICE_TYPE_VERSION 1 +#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_ID 0x0044 +#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1 namespace esp_matter { @@ -621,6 +623,19 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat esp_err_t add(endpoint_t *endpoint, config_t *config); } /* water_leak_detector */ +namespace rain_sensor { +typedef struct config { + cluster::descriptor::config_t descriptor; + cluster::identify::config_t identify; + cluster::boolean_state::config_t boolean_state; +} 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); +} /* rain_sensor */ + } /* endpoint */ namespace node { diff --git a/components/esp_matter/esp_matter_event.cpp b/components/esp_matter/esp_matter_event.cpp index cba424cef..d93f18b1c 100644 --- a/components/esp_matter/esp_matter_event.cpp +++ b/components/esp_matter/esp_matter_event.cpp @@ -453,6 +453,22 @@ event_t *create_state_change(cluster_t *cluster) } // namespace event } // namespace boolean_state +namespace boolean_state_configuration { +namespace event { + +event_t *create_alarms_state_changed(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BooleanStateConfiguration::Events::AlarmsStateChanged::Id); +} + +event_t *create_sensor_fault(cluster_t *cluster) +{ + return esp_matter::event::create(cluster, BooleanStateConfiguration::Events::SensorFault::Id); +} + +} // namespace event +} // namespace boolean_state_configuration + namespace operational_state { namespace event { diff --git a/components/esp_matter/esp_matter_event.h b/components/esp_matter/esp_matter_event.h index a35b85a3c..1cb01de5b 100644 --- a/components/esp_matter/esp_matter_event.h +++ b/components/esp_matter/esp_matter_event.h @@ -158,6 +158,13 @@ event_t *create_state_change(cluster_t *cluster); } // namespace event } // namespace boolean_state +namespace boolean_state_configuration { +namespace event { +event_t *create_alarms_state_changed(cluster_t *cluster); +event_t *create_sensor_fault(cluster_t *cluster); +} // namespace event +} // namespace boolean_state_configuration + namespace operational_state { namespace event { event_t *create_operational_error(cluster_t *cluster); diff --git a/components/esp_matter/esp_matter_feature.cpp b/components/esp_matter/esp_matter_feature.cpp index 3739e24cf..726b0c529 100644 --- a/components/esp_matter/esp_matter_feature.cpp +++ b/components/esp_matter/esp_matter_feature.cpp @@ -3395,5 +3395,108 @@ esp_err_t add(cluster_t *cluster) } /* feature */ } /* keypad_input */ +namespace boolean_state_configuration { +namespace feature { + +namespace visual { + +uint32_t get_id() +{ + return (uint32_t)BooleanStateConfiguration::Feature::kVisual; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + attribute::create_alarms_active(cluster, config->alarms_active); + attribute::create_alarms_supported(cluster, config->alarms_supported); + + command::create_enable_disable_alarm(cluster);; + return ESP_OK; +} +} /* visual */ + +namespace audible { + +uint32_t get_id() +{ + return (uint32_t)BooleanStateConfiguration::Feature::kAudible; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + attribute::create_alarms_active(cluster, config->alarms_active); + attribute::create_alarms_supported(cluster, config->alarms_supported); + + command::create_enable_disable_alarm(cluster);; + return ESP_OK; +} +} /* audible */ + +namespace alarm_suppress { + +uint32_t get_id() +{ + return (uint32_t)BooleanStateConfiguration::Feature::kAlarmSuppress; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + uint32_t visual_feature_map = feature::visual::get_id(); + uint32_t audible_feature_map = feature::audible::get_id(); + if((get_feature_map_value(cluster) & visual_feature_map) == visual_feature_map || + (get_feature_map_value(cluster) & audible_feature_map) == audible_feature_map) { + update_feature_map(cluster, get_id()); + + attribute::create_alarms_suppressed(cluster, config->alarms_suppressed); + + command::create_suppress_alarm(cluster); + } else { + ESP_LOGE(TAG, "Cluster shall support either visual or audio feature"); + return ESP_ERR_NOT_SUPPORTED; + } + return ESP_OK; +} +} /* alarm_suppress */ + +namespace sensitivity_level { + +uint32_t get_id() +{ + return (uint32_t)BooleanStateConfiguration::Feature::kSensitivityLevel; +} + +esp_err_t add(cluster_t *cluster, config_t *config) +{ + if (!cluster) { + ESP_LOGE(TAG, "Cluster cannot be NULL"); + return ESP_ERR_INVALID_ARG; + } + update_feature_map(cluster, get_id()); + + attribute::create_current_sensitivity_level(cluster, 0); + attribute::create_supported_sensitivity_levels(cluster, config->supported_sensitivity_levels); + return ESP_OK; +} +} /* sensitivity_level */ + +} /* feature */ +} /* boolean_state_configuration */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/esp_matter_feature.h b/components/esp_matter/esp_matter_feature.h index 2e640fb88..2631756df 100644 --- a/components/esp_matter/esp_matter_feature.h +++ b/components/esp_matter/esp_matter_feature.h @@ -1587,5 +1587,57 @@ esp_err_t add(cluster_t *cluster); } /* feature */ } /* keypad_input */ +namespace boolean_state_configuration { +namespace feature { + +namespace visual { + +typedef struct config { + uint8_t alarms_active; + uint8_t alarms_supported; + config() : alarms_active(0), alarms_supported(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* visual */ + +namespace audible { + +typedef struct config { + uint8_t alarms_active; + uint8_t alarms_supported; + config() : alarms_active(0), alarms_supported(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* audible */ + +namespace alarm_suppress { + +typedef struct config { + uint8_t alarms_suppressed; + config() : alarms_suppressed(0) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* alarm_suppress */ + +namespace sensitivity_level { + +typedef struct config { + uint8_t supported_sensitivity_levels; + config() : supported_sensitivity_levels(10) {} +} config_t; + +uint32_t get_id(); +esp_err_t add(cluster_t *cluster, config_t *config); +} /* sensitivity_level */ + +} /* feature */ +} /* boolean_state_configuration */ + } /* cluster */ } /* esp_matter */ diff --git a/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h b/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h index 6b712d586..60a9c222b 100644 --- a/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h +++ b/components/esp_matter/zap_common/app/PluginApplicationCallbacks.h @@ -114,6 +114,7 @@ void MatterUserLabelPluginServerInitCallback(); void MatterWakeOnLanPluginServerInitCallback(); void MatterWiFiNetworkDiagnosticsPluginServerInitCallback(); void MatterWindowCoveringPluginServerInitCallback(); +void MatterBooleanStateConfigurationPluginServerInitCallback(); #include diff --git a/examples/all_device_types_app/main/device_types.h b/examples/all_device_types_app/main/device_types.h index f28a5bb7c..fffb4e4aa 100644 --- a/examples/all_device_types_app/main/device_types.h +++ b/examples/all_device_types_app/main/device_types.h @@ -39,6 +39,7 @@ enum device_type_enum { ESP_MATTER_SMOKE_CO_ALARM, ESP_MATTER_WATER_LEAK_DETECTOR, ESP_MATTER_POWER_SOURCE, + ESP_MATTER_RAIN_SENSOR, ESP_MATTER_DEVICE_TYPE_MAX }; @@ -83,6 +84,7 @@ const device_type_name device_type_list[ESP_MATTER_DEVICE_TYPE_MAX] = { {"dish_washer", ESP_MATTER_DISH_WASHER}, {"smoke_co_alarm", ESP_MATTER_SMOKE_CO_ALARM}, {"water_leak_detector", ESP_MATTER_WATER_LEAK_DETECTOR}, - {"power_source", ESP_MATTER_POWER_SOURCE} + {"power_source", ESP_MATTER_POWER_SOURCE}, + {"rain_sensor", ESP_MATTER_RAIN_SENSOR} }; } /* 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 97a929a3e..3c32b3201 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 @@ -359,6 +359,11 @@ int create(uint8_t device_type_index) endpoint = esp_matter::endpoint::power_source_device::create(node, &power_source_device_config, ENDPOINT_FLAG_NONE, NULL); break; } + case ESP_MATTER_RAIN_SENSOR: { + esp_matter::endpoint::rain_sensor::config_t rain_sensor_config; + endpoint = esp_matter::endpoint::rain_sensor::create(node, &rain_sensor_config, ENDPOINT_FLAG_NONE, NULL); + break; + } default: { ESP_LOGE(TAG, "Please input a valid device type"); break;