mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Merge branch 'device/pump' into 'main'
Added Pump device type to data model See merge request app-frameworks/esp-matter!298
This commit is contained in:
@@ -1898,5 +1898,125 @@ attribute_t *create_flow_tolerance(cluster_t *cluster, uint16_t value, uint16_t
|
||||
} /* attribute */
|
||||
} /* flow_measurement */
|
||||
|
||||
namespace pump_configuration_and_control {
|
||||
namespace attribute {
|
||||
|
||||
attribute_t *create_max_pressure(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_speed(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxSpeed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_flow(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxFlow::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_min_const_pressure(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MinConstPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_const_pressure(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxConstPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_min_comp_pressure(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MinCompPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_comp_pressure(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxCompPressure::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_min_const_speed(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MinConstSpeed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_const_speed(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxConstSpeed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_min_const_flow(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MinConstFlow::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_const_flow(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxConstFlow::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_min_const_temp(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MinConstTemp::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_max_const_temp(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::MaxConstTemp::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_pump_status(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::PumpStatus::Id, ATTRIBUTE_FLAG_NONE, esp_matter_bitmap16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_effective_operation_mode(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::EffectiveOperationMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value));
|
||||
}
|
||||
|
||||
attribute_t *create_effective_control_mode(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::EffectiveControlMode::Id, ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value));
|
||||
}
|
||||
|
||||
attribute_t *create_capacity(cluster_t *cluster, nullable<int16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::Capacity::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_int16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_speed(cluster_t *cluster, nullable<uint16_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::Speed::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_lifetime_running_hours(cluster_t *cluster, nullable<uint32_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::LifetimeRunningHours::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value));
|
||||
}
|
||||
|
||||
attribute_t *create_pump_power(cluster_t *cluster, nullable<uint32_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::Power::Id, ATTRIBUTE_FLAG_NULLABLE, esp_matter_nullable_uint32(value));
|
||||
}
|
||||
|
||||
attribute_t *create_lifetime_energy_consumed(cluster_t *cluster, nullable<uint32_t> value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::LifetimeEnergyConsumed::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NULLABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_nullable_uint32(value));
|
||||
}
|
||||
|
||||
attribute_t *create_operation_mode(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::OperationMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value));
|
||||
}
|
||||
|
||||
attribute_t *create_control_mode(cluster_t *cluster, uint8_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, PumpConfigurationAndControl::Attributes::ControlMode::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, esp_matter_enum8(value));
|
||||
}
|
||||
} /* attribute */
|
||||
} /* pump_configuration_and_control */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -466,5 +466,33 @@ attribute_t *create_flow_tolerance(cluster_t *cluster, uint16_t value, uint16_t
|
||||
} /* attribute */
|
||||
} /* flow_measurement */
|
||||
|
||||
namespace pump_configuration_and_control {
|
||||
namespace attribute {
|
||||
attribute_t *create_max_pressure(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_max_speed(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_max_flow(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_min_const_pressure(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_max_const_pressure(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_min_comp_pressure(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_max_comp_pressure(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_min_const_speed(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_max_const_speed(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_min_const_flow(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_max_const_flow(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_min_const_temp(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_max_const_temp(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_pump_status(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_effective_operation_mode(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_effective_control_mode(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_capacity(cluster_t *cluster, nullable<int16_t> value);
|
||||
attribute_t *create_speed(cluster_t *cluster, nullable<uint16_t> value);
|
||||
attribute_t *create_lifetime_running_hours(cluster_t *cluster, nullable<uint32_t> value);
|
||||
attribute_t *create_pump_power(cluster_t *cluster, nullable<uint32_t> value);
|
||||
attribute_t *create_lifetime_energy_consumed(cluster_t *cluster, nullable<uint32_t> value);
|
||||
attribute_t *create_operation_mode(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_control_mode(cluster_t *cluster, uint8_t value);
|
||||
} /* attribute */
|
||||
} /* pump_configuration_and_control */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -1761,5 +1761,51 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
||||
}
|
||||
} /* flow_measurement */
|
||||
|
||||
namespace pump_configuration_and_control {
|
||||
const function_generic_t function_list[] = {
|
||||
(function_generic_t)emberAfPumpConfigurationAndControlClusterServerInitCallback,
|
||||
(function_generic_t)MatterPumpConfigurationAndControlClusterServerPreAttributeChangedCallback,
|
||||
};
|
||||
const int function_flags = CLUSTER_FLAG_INIT_FUNCTION | CLUSTER_FLAG_PRE_ATTRIBUTE_CHANGED_FUNCTION;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags)
|
||||
{
|
||||
cluster_t *cluster = cluster::create(endpoint, PumpConfigurationAndControl::Id, flags);
|
||||
if (!cluster) {
|
||||
ESP_LOGE(TAG, "Could not create cluster");
|
||||
return NULL;
|
||||
}
|
||||
if (flags & CLUSTER_FLAG_SERVER) {
|
||||
set_plugin_server_init_callback(cluster, MatterPumpConfigurationAndControlPluginServerInitCallback);
|
||||
add_function_list(cluster, function_list, function_flags);
|
||||
}
|
||||
if (flags & CLUSTER_FLAG_CLIENT) {
|
||||
set_plugin_client_init_callback(cluster, MatterPumpConfigurationAndControlPluginClientInitCallback);
|
||||
create_default_binding_cluster(endpoint);
|
||||
}
|
||||
|
||||
if (flags & CLUSTER_FLAG_SERVER) {
|
||||
/* Attributes managed internally */
|
||||
global::attribute::create_feature_map(cluster, 0);
|
||||
|
||||
/** Attributes not managed internally **/
|
||||
if (config) {
|
||||
global::attribute::create_cluster_revision(cluster, config->cluster_revision);
|
||||
attribute::create_max_pressure(cluster, config->max_pressure);
|
||||
attribute::create_max_speed(cluster, config->max_speed);
|
||||
attribute::create_max_flow(cluster, config->max_flow);
|
||||
attribute::create_effective_operation_mode(cluster, config->effective_operation_mode);
|
||||
attribute::create_effective_control_mode(cluster, config->effective_control_mode);
|
||||
attribute::create_capacity(cluster, config->capacity);
|
||||
attribute::create_operation_mode(cluster, config->operation_mode);
|
||||
} else {
|
||||
ESP_LOGE(TAG, "Config is NULL. Cannot add some attributes.");
|
||||
}
|
||||
}
|
||||
|
||||
return cluster;
|
||||
}
|
||||
} /* pump_configuration_and_control */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -448,7 +448,26 @@ typedef struct config {
|
||||
} config_t;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
}
|
||||
} /* flow_measurement */
|
||||
|
||||
namespace pump_configuration_and_control {
|
||||
typedef struct config {
|
||||
uint16_t cluster_revision;
|
||||
// Pump Information Attributes
|
||||
const nullable<int16_t> max_pressure;
|
||||
const nullable<uint16_t> max_speed;
|
||||
const nullable<uint16_t> max_flow;
|
||||
// Pump Dynamic Information Attributes
|
||||
uint8_t effective_operation_mode;
|
||||
uint8_t effective_control_mode;
|
||||
nullable<int16_t> capacity;
|
||||
// Pump Settings Attributes
|
||||
uint8_t operation_mode;
|
||||
config() : cluster_revision(3), max_pressure(), max_speed(), max_flow(), effective_operation_mode(0), effective_control_mode(0), capacity(), operation_mode(0) {}
|
||||
} config_t;
|
||||
|
||||
cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags);
|
||||
} /* pump_configuration_and_control */
|
||||
|
||||
} /* cluster */
|
||||
} /* esp_matter */
|
||||
|
||||
@@ -840,6 +840,42 @@ endpoint_t *add(endpoint_t *endpoint, config_t *config)
|
||||
return endpoint;
|
||||
}
|
||||
} /* flow_sensor */
|
||||
|
||||
namespace pump{
|
||||
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_PUMP_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
uint8_t get_device_type_version()
|
||||
{
|
||||
return ESP_MATTER_PUMP_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);
|
||||
return add(endpoint, config);
|
||||
}
|
||||
|
||||
endpoint_t *add(endpoint_t *endpoint, config_t *config)
|
||||
{
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
add_device_type(endpoint, get_device_type_id(), get_device_type_version());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER, ESP_MATTER_NONE_FEATURE_ID);
|
||||
pump_configuration_and_control::create(endpoint, &(config->pump_configuration_and_control), CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /** pump **/
|
||||
|
||||
} /* endpoint */
|
||||
|
||||
namespace node {
|
||||
|
||||
@@ -70,6 +70,8 @@
|
||||
#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_VERSION 2
|
||||
#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_ID 0x0202
|
||||
#define ESP_MATTER_WINDOW_COVERING_DEVICE_TYPE_VERSION 2
|
||||
#define ESP_MATTER_PUMP_DEVICE_TYPE_ID 0x0303
|
||||
#define ESP_MATTER_PUMP_DEVICE_TYPE_VERSION 2
|
||||
|
||||
namespace esp_matter {
|
||||
|
||||
@@ -382,6 +384,19 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags, void *priv_dat
|
||||
endpoint_t *add(endpoint_t *endpoint, config_t *config);
|
||||
} /* flow_sensor */
|
||||
|
||||
namespace pump{
|
||||
typedef struct config {
|
||||
cluster::identify::config_t identify;
|
||||
cluster::on_off::config_t on_off;
|
||||
cluster::pump_configuration_and_control::config_t pump_configuration_and_control;
|
||||
} 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);
|
||||
endpoint_t *add(endpoint_t *endpoint, config_t *config);
|
||||
} /** pump **/
|
||||
|
||||
} /* endpoint */
|
||||
|
||||
namespace node {
|
||||
|
||||
Reference in New Issue
Block a user