mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
esp_matter_endpoint: Adding more device types
This commit is contained in:
@@ -8,6 +8,8 @@ variables:
|
||||
GIT_SUBMODULE_STRATEGY: none
|
||||
|
||||
.chip_submodule_update: &chip_submodule_update
|
||||
# - rm -rf .git/modules/connectedhomeip/
|
||||
# - git config --remove-section submodule.connectedhomeip
|
||||
- git submodule sync --recursive
|
||||
- git submodule update --recursive --init --reference /local_references/github/
|
||||
|
||||
|
||||
@@ -599,6 +599,48 @@ attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value)
|
||||
esp_matter_bitmap16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTemperature::Id, ATTRIBUTE_FLAG_NONE,
|
||||
esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMin::Id,
|
||||
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::ColorTempPhysicalMax::Id,
|
||||
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::CoupleColorTempToLevelMinMireds::Id,
|
||||
ATTRIBUTE_FLAG_NONE, esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_startup_color_temperature_mireds(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::StartUpColorTemperatureMireds::Id,
|
||||
ATTRIBUTE_FLAG_WRITABLE, esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_current_x(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentX::Id, ATTRIBUTE_FLAG_NONE,
|
||||
esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
attribute_t *create_current_y(cluster_t *cluster, uint16_t value)
|
||||
{
|
||||
return esp_matter::attribute::create(cluster, ColorControl::Attributes::CurrentY::Id, ATTRIBUTE_FLAG_NONE,
|
||||
esp_matter_uint16(value));
|
||||
}
|
||||
|
||||
} /* attribute */
|
||||
} /* color_control */
|
||||
|
||||
|
||||
@@ -190,6 +190,13 @@ attribute_t *create_color_mode(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_color_control_options(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_enhanced_color_mode(cluster_t *cluster, uint8_t value);
|
||||
attribute_t *create_color_capabilities(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_color_temperature_mireds(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_color_temp_physical_min_mireds(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_color_temp_physical_max_mireds(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_couple_color_temp_to_level_min_mireds(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_startup_color_temperature_mireds(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_current_x(cluster_t *cluster, uint16_t value);
|
||||
attribute_t *create_current_y(cluster_t *cluster, uint16_t value);
|
||||
} /* attribute */
|
||||
} /* color_control */
|
||||
|
||||
|
||||
@@ -752,6 +752,9 @@ cluster_t *create(endpoint_t *endpoint, config_t *config, uint8_t flags, uint32_
|
||||
if (features & feature::hue_saturation::get_id()) {
|
||||
feature::hue_saturation::add(cluster, &(config->hue_saturation));
|
||||
}
|
||||
if (features & feature::color_temperature::get_id()) {
|
||||
feature::color_temperature::add(cluster, &(config->color_temperature));
|
||||
}
|
||||
|
||||
return cluster;
|
||||
}
|
||||
|
||||
@@ -206,6 +206,7 @@ typedef struct config {
|
||||
uint8_t enhanced_color_mode;
|
||||
uint16_t color_capabilities;
|
||||
feature::hue_saturation::config_t hue_saturation;
|
||||
feature::color_temperature::config_t color_temperature;
|
||||
config() : cluster_revision(3), color_mode(1), color_control_options(0), enhanced_color_mode(1),
|
||||
color_capabilities(0) {}
|
||||
} config_t;
|
||||
|
||||
@@ -830,6 +830,75 @@ static esp_err_t esp_matter_command_callback_stop_move_step(const ConcreteComman
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_move_to_color_temperature(const ConcreteCommandPath &command_path,
|
||||
TLVReader &tlv_data, void *opaque_ptr)
|
||||
{
|
||||
chip::app::Clusters::ColorControl::Commands::MoveToColorTemperature::DecodableType command_data;
|
||||
CHIP_ERROR error = Decode(tlv_data, command_data);
|
||||
if (error == CHIP_NO_ERROR) {
|
||||
emberAfColorControlClusterMoveToColorTemperatureCallback((CommandHandler *)opaque_ptr, command_path,
|
||||
command_data);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_move_color_temperature(const ConcreteCommandPath &command_path,
|
||||
TLVReader &tlv_data, void *opaque_ptr)
|
||||
{
|
||||
chip::app::Clusters::ColorControl::Commands::MoveColorTemperature::DecodableType command_data;
|
||||
CHIP_ERROR error = Decode(tlv_data, command_data);
|
||||
if (error == CHIP_NO_ERROR) {
|
||||
emberAfColorControlClusterMoveColorTemperatureCallback((CommandHandler *)opaque_ptr, command_path,
|
||||
command_data);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_step_color_temperature(const ConcreteCommandPath &command_path,
|
||||
TLVReader &tlv_data, void *opaque_ptr)
|
||||
{
|
||||
chip::app::Clusters::ColorControl::Commands::StepColorTemperature::DecodableType command_data;
|
||||
CHIP_ERROR error = Decode(tlv_data, command_data);
|
||||
if (error == CHIP_NO_ERROR) {
|
||||
emberAfColorControlClusterStepColorTemperatureCallback((CommandHandler *)opaque_ptr, command_path,
|
||||
command_data);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_move_to_color(const ConcreteCommandPath &command_path,
|
||||
TLVReader &tlv_data, void *opaque_ptr)
|
||||
{
|
||||
chip::app::Clusters::ColorControl::Commands::MoveToColor::DecodableType command_data;
|
||||
CHIP_ERROR error = Decode(tlv_data, command_data);
|
||||
if (error == CHIP_NO_ERROR) {
|
||||
emberAfColorControlClusterMoveToColorCallback((CommandHandler *)opaque_ptr, command_path, command_data);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_move_color(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
|
||||
void *opaque_ptr)
|
||||
{
|
||||
chip::app::Clusters::ColorControl::Commands::MoveColor::DecodableType command_data;
|
||||
CHIP_ERROR error = Decode(tlv_data, command_data);
|
||||
if (error == CHIP_NO_ERROR) {
|
||||
emberAfColorControlClusterMoveColorCallback((CommandHandler *)opaque_ptr, command_path, command_data);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_step_color(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
|
||||
void *opaque_ptr)
|
||||
{
|
||||
chip::app::Clusters::ColorControl::Commands::StepColor::DecodableType command_data;
|
||||
CHIP_ERROR error = Decode(tlv_data, command_data);
|
||||
if (error == CHIP_NO_ERROR) {
|
||||
emberAfColorControlClusterStepColorCallback((CommandHandler *)opaque_ptr, command_path, command_data);
|
||||
}
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
static esp_err_t esp_matter_command_callback_lock_door(const ConcreteCommandPath &command_path, TLVReader &tlv_data,
|
||||
void *opaque_ptr)
|
||||
{
|
||||
@@ -1484,6 +1553,42 @@ command_t *create_stop_move_step(cluster_t *cluster)
|
||||
esp_matter_command_callback_stop_move_step);
|
||||
}
|
||||
|
||||
command_t *create_move_to_color_temperature(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, ColorControl::Commands::MoveToColorTemperature::Id,
|
||||
COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_to_color_temperature);
|
||||
}
|
||||
|
||||
command_t *create_move_color_temperature(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, ColorControl::Commands::MoveColorTemperature::Id,
|
||||
COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_move_color_temperature);
|
||||
}
|
||||
|
||||
command_t *create_step_color_temperature(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, ColorControl::Commands::StepColorTemperature::Id,
|
||||
COMMAND_FLAG_ACCEPTED, esp_matter_command_callback_step_color_temperature);
|
||||
}
|
||||
|
||||
command_t *create_move_to_color(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, ColorControl::Commands::MoveToColor::Id, COMMAND_FLAG_ACCEPTED,
|
||||
esp_matter_command_callback_move_to_color);
|
||||
}
|
||||
|
||||
command_t *create_move_color(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, ColorControl::Commands::MoveColor::Id, COMMAND_FLAG_ACCEPTED,
|
||||
esp_matter_command_callback_move_color);
|
||||
}
|
||||
|
||||
command_t *create_step_color(cluster_t *cluster)
|
||||
{
|
||||
return esp_matter::command::create(cluster, ColorControl::Commands::StepColor::Id, COMMAND_FLAG_ACCEPTED,
|
||||
esp_matter_command_callback_step_color);
|
||||
}
|
||||
|
||||
} /* command */
|
||||
} /* color_control */
|
||||
|
||||
|
||||
@@ -178,6 +178,12 @@ command_t *create_move_saturation(cluster_t *cluster);
|
||||
command_t *create_step_saturation(cluster_t *cluster);
|
||||
command_t *create_move_to_hue_and_saturation(cluster_t *cluster);
|
||||
command_t *create_stop_move_step(cluster_t *cluster);
|
||||
command_t *create_move_to_color_temperature(cluster_t *cluster);
|
||||
command_t *create_move_color_temperature(cluster_t *cluster);
|
||||
command_t *create_step_color_temperature(cluster_t *cluster);
|
||||
command_t *create_move_to_color(cluster_t *cluster);
|
||||
command_t *create_move_color(cluster_t *cluster);
|
||||
command_t *create_step_color(cluster_t *cluster);
|
||||
} /* command */
|
||||
} /* color_control */
|
||||
|
||||
|
||||
@@ -18,14 +18,24 @@
|
||||
|
||||
/* Replace these with IDs from submodule whenever they are implemented */
|
||||
#define ESP_MATTER_ROOT_NODE_DEVICE_TYPE_ID 0x0016
|
||||
#define ESP_MATTER_BRIDGE_DEVICE_TYPE_ID 0x000E
|
||||
#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID 0x0013
|
||||
|
||||
#define ESP_MATTER_ON_OFF_LIGHT_DEVICE_TYPE_ID 0x0100
|
||||
#define ESP_MATTER_DIMMABLE_LIGHT_DEVICE_TYPE_ID 0x0101
|
||||
#define ESP_MATTER_COLOR_DIMMABLE_LIGHT_DEVICE_TYPE_ID 0x0102
|
||||
#define ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_ID 0x010C
|
||||
#define ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_ID 0x010D
|
||||
|
||||
#define ESP_MATTER_ON_OFF_SWITCH_DEVICE_TYPE_ID 0x0103
|
||||
#define ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0104
|
||||
#define ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_ID 0x0105
|
||||
|
||||
#define ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010A
|
||||
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010B
|
||||
|
||||
#define ESP_MATTER_FAN_DEVICE_TYPE_ID 0x002B
|
||||
#define ESP_MATTER_THERMOSTAT_DEVICE_TYPE_ID 0x0301
|
||||
#define ESP_MATTER_BRIDGE_DEVICE_TYPE_ID 0x000E
|
||||
#define ESP_MATTER_BRIDGED_NODE_DEVICE_TYPE_ID 0x0013
|
||||
#define ESP_MATTER_DOOR_LOCK_DEVICE_TYPE_ID 0x000A
|
||||
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302
|
||||
|
||||
@@ -150,6 +160,64 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
}
|
||||
} /* color_dimmable_light */
|
||||
|
||||
namespace color_temperature_light {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_COLOR_TEMPERATURE_LIGHT_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
|
||||
scenes::create(endpoint, &(config->scenes), CLUSTER_FLAG_SERVER);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER, on_off::feature::lighting::get_id());
|
||||
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER,
|
||||
level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id());
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER,
|
||||
color_control::feature::color_temperature::get_id());
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* color_temperature_light */
|
||||
|
||||
namespace extended_color_light {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_EXTENDED_COLOR_LIGHT_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
|
||||
scenes::create(endpoint, &(config->scenes), CLUSTER_FLAG_SERVER);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER, on_off::feature::lighting::get_id());
|
||||
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER,
|
||||
level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id());
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_SERVER,
|
||||
color_control::feature::color_temperature::get_id() | color_control::feature::xy::get_id());
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* extended_color_light */
|
||||
|
||||
namespace on_off_switch {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
@@ -177,6 +245,115 @@ endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
}
|
||||
} /* on_off_switch */
|
||||
|
||||
namespace dimmer_switch {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_DIMMER_SWITCH_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_CLIENT);
|
||||
scenes::create(endpoint, &(config->scenes), CLUSTER_FLAG_CLIENT);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_CLIENT, ESP_MATTER_NONE_FEATURE_ID);
|
||||
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_CLIENT, ESP_MATTER_NONE_FEATURE_ID);
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* dimmer_switch */
|
||||
|
||||
namespace color_dimmer_switch {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_COLOR_DIMMER_SWITCH_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_CLIENT);
|
||||
scenes::create(endpoint, &(config->scenes), CLUSTER_FLAG_CLIENT);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_CLIENT, ESP_MATTER_NONE_FEATURE_ID);
|
||||
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_CLIENT, ESP_MATTER_NONE_FEATURE_ID);
|
||||
color_control::create(endpoint, &(config->color_control), CLUSTER_FLAG_CLIENT, ESP_MATTER_NONE_FEATURE_ID);
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
binding::create(endpoint, &(config->binding), CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* color_dimmer_switch */
|
||||
|
||||
namespace on_off_plugin_unit {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
|
||||
scenes::create(endpoint, &(config->scenes), CLUSTER_FLAG_SERVER);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER, on_off::feature::lighting::get_id());
|
||||
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER,
|
||||
level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id());
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* on_off_plugin_unit */
|
||||
|
||||
namespace dimmable_plugin_unit {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags)
|
||||
{
|
||||
endpoint_t *endpoint = endpoint::create(node, flags);
|
||||
if (!endpoint) {
|
||||
ESP_LOGE(TAG, "Could not create endpoint");
|
||||
return NULL;
|
||||
}
|
||||
set_device_type_id(endpoint, get_device_type_id());
|
||||
|
||||
identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
|
||||
scenes::create(endpoint, &(config->scenes), CLUSTER_FLAG_SERVER);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER, on_off::feature::lighting::get_id());
|
||||
level_control::create(endpoint, &(config->level_control), CLUSTER_FLAG_SERVER,
|
||||
level_control::feature::on_off::get_id() | level_control::feature::lighting::get_id());
|
||||
descriptor::create(endpoint, CLUSTER_FLAG_SERVER);
|
||||
|
||||
return endpoint;
|
||||
}
|
||||
} /* dimmable_plugin_unit */
|
||||
|
||||
namespace fan {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
|
||||
@@ -88,6 +88,34 @@ uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* color_dimmable_light */
|
||||
|
||||
namespace color_temperature_light {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
groups::config_t groups;
|
||||
scenes::config_t scenes;
|
||||
on_off::config_t on_off;
|
||||
level_control::config_t level_control;
|
||||
color_control::config_t color_control;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* color_temperature_light */
|
||||
|
||||
namespace extended_color_light {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
groups::config_t groups;
|
||||
scenes::config_t scenes;
|
||||
on_off::config_t on_off;
|
||||
level_control::config_t level_control;
|
||||
color_control::config_t color_control;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* extended_color_light */
|
||||
|
||||
namespace on_off_switch {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
@@ -102,6 +130,61 @@ uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* on_off_switch */
|
||||
|
||||
namespace dimmer_switch {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
groups::config_t groups;
|
||||
scenes::config_t scenes;
|
||||
on_off::config_t on_off;
|
||||
level_control::config_t level_control;
|
||||
binding::config_t binding;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* dimmer_switch */
|
||||
|
||||
namespace color_dimmer_switch {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
groups::config_t groups;
|
||||
scenes::config_t scenes;
|
||||
on_off::config_t on_off;
|
||||
level_control::config_t level_control;
|
||||
color_control::config_t color_control;
|
||||
binding::config_t binding;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* color_dimmer_switch */
|
||||
|
||||
namespace on_off_plugin_unit {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
groups::config_t groups;
|
||||
scenes::config_t scenes;
|
||||
on_off::config_t on_off;
|
||||
level_control::config_t level_control;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* on_off_plugin_unit */
|
||||
|
||||
namespace dimmable_plugin_unit {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
groups::config_t groups;
|
||||
scenes::config_t scenes;
|
||||
on_off::config_t on_off;
|
||||
level_control::config_t level_control;
|
||||
} config_t;
|
||||
|
||||
uint32_t get_device_type_id();
|
||||
endpoint_t *create(node_t *node, config_t *config, uint8_t flags);
|
||||
} /* dimmable_plugin_unit */
|
||||
|
||||
namespace fan {
|
||||
typedef struct config {
|
||||
identify::config_t identify;
|
||||
|
||||
@@ -172,6 +172,69 @@ esp_err_t add(cluster_t *cluster, config_t *config)
|
||||
}
|
||||
|
||||
} /* hue_saturation */
|
||||
|
||||
namespace color_temperature {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::ColorControl::ColorCapabilities::kColorTemperatureSupported;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
/* Attributes not managed internally */
|
||||
attribute::create_color_temperature_mireds(cluster, config->color_temperature_mireds);
|
||||
attribute::create_color_temp_physical_min_mireds(cluster, config->color_temp_physical_min_mireds);
|
||||
attribute::create_color_temp_physical_max_mireds(cluster, config->color_temp_physical_max_mireds);
|
||||
attribute::create_couple_color_temp_to_level_min_mireds(cluster, config->couple_color_temp_to_level_min_mireds);
|
||||
attribute::create_startup_color_temperature_mireds(cluster, config->startup_color_temperature_mireds);
|
||||
|
||||
/* Commands */
|
||||
command::create_move_to_color_temperature(cluster);
|
||||
command::create_stop_move_step(cluster);
|
||||
command::create_move_color_temperature(cluster);
|
||||
command::create_step_color_temperature(cluster);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
} /* color_temperature */
|
||||
|
||||
namespace xy {
|
||||
|
||||
uint32_t get_id()
|
||||
{
|
||||
return (uint32_t)chip::app::Clusters::ColorControl::ColorCapabilities::kXYAttributesSupported;
|
||||
}
|
||||
|
||||
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());
|
||||
|
||||
/* Attributes not managed internally */
|
||||
attribute::create_current_x(cluster, config->current_x);
|
||||
attribute::create_current_y(cluster, config->current_y);
|
||||
|
||||
/* Commands */
|
||||
command::create_move_to_color(cluster);
|
||||
command::create_stop_move_step(cluster);
|
||||
command::create_move_color(cluster);
|
||||
command::create_step_color(cluster);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
} /* xy */
|
||||
} /* feature */
|
||||
} /* color_control */
|
||||
|
||||
|
||||
@@ -90,6 +90,37 @@ uint32_t get_id();
|
||||
esp_err_t add(cluster_t *cluster, config_t *config);
|
||||
|
||||
} /* hue_saturation */
|
||||
|
||||
namespace color_temperature {
|
||||
|
||||
typedef struct config {
|
||||
uint16_t color_temperature_mireds;
|
||||
uint16_t color_temp_physical_min_mireds;
|
||||
uint16_t color_temp_physical_max_mireds;
|
||||
uint16_t couple_color_temp_to_level_min_mireds;
|
||||
uint16_t startup_color_temperature_mireds;
|
||||
config() : color_temperature_mireds(0x00fa), color_temp_physical_min_mireds(0),
|
||||
color_temp_physical_max_mireds(0xfeff), couple_color_temp_to_level_min_mireds(0),
|
||||
startup_color_temperature_mireds(0) {}
|
||||
} config_t;
|
||||
|
||||
uint32_t get_id();
|
||||
esp_err_t add(cluster_t *cluster, config_t *config);
|
||||
|
||||
} /* color_temperature */
|
||||
|
||||
namespace xy {
|
||||
|
||||
typedef struct config {
|
||||
uint16_t current_x;
|
||||
uint16_t current_y;
|
||||
config() : current_x(0x616b), current_y(0x607d) {}
|
||||
} config_t;
|
||||
|
||||
uint32_t get_id();
|
||||
esp_err_t add(cluster_t *cluster, config_t *config);
|
||||
|
||||
} /* xy */
|
||||
} /* feature */
|
||||
} /* color_control */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user