mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'device/rain_sensor' into 'main'
Add Rain Sensor device type See merge request app-frameworks/esp-matter!661
This commit is contained in:
@@ -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 {
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -2677,7 +2677,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.");
|
||||
}
|
||||
@@ -2687,6 +2687,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,
|
||||
|
||||
@@ -655,6 +655,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;
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -3385,5 +3385,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 */
|
||||
|
||||
@@ -1627,5 +1627,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 */
|
||||
|
||||
@@ -114,6 +114,7 @@ void MatterUserLabelPluginServerInitCallback();
|
||||
void MatterWakeOnLanPluginServerInitCallback();
|
||||
void MatterWiFiNetworkDiagnosticsPluginServerInitCallback();
|
||||
void MatterWindowCoveringPluginServerInitCallback();
|
||||
void MatterBooleanStateConfigurationPluginServerInitCallback();
|
||||
|
||||
#include <esp_matter_cluster.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 */
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user