mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
components/esp-matter: Add Mounted On Off Control and Mounted Dimmable Load Control device types.
This commit is contained in:
@@ -34,6 +34,8 @@ c. Smart Plugs/Outlets
|
||||
2. Dimmable Plugin Unit
|
||||
3. Pump
|
||||
4. Water Valve
|
||||
5. Mounted On Off Control
|
||||
6. Mounted Dimmable Load Control
|
||||
|
||||
d. Generic
|
||||
1. Mode Select
|
||||
|
||||
@@ -1945,6 +1945,77 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
|
||||
}
|
||||
} /* secondary_network_interface */
|
||||
|
||||
namespace mounted_on_off_control {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
uint8_t get_device_type_version()
|
||||
{
|
||||
return ESP_MATTER_MOUNTED_ON_OFF_CONTROL_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)
|
||||
{
|
||||
VerifyOrReturnError(endpoint != nullptr, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Endpoint cannot be NULL"));
|
||||
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;
|
||||
}
|
||||
|
||||
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
identify::command::create_trigger_effect(identify_cluster);
|
||||
groups::create(endpoint, &(config->groups), CLUSTER_FLAG_SERVER);
|
||||
on_off::create(endpoint, &(config->on_off), CLUSTER_FLAG_SERVER, on_off::feature::lighting::get_id());
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
} /* mounted_on_off_control */
|
||||
|
||||
namespace mounted_dimmable_load_control {
|
||||
uint32_t get_device_type_id()
|
||||
{
|
||||
return ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID;
|
||||
}
|
||||
|
||||
uint8_t get_device_type_version()
|
||||
{
|
||||
return ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_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)
|
||||
{
|
||||
VerifyOrReturnError(endpoint != nullptr, ESP_ERR_INVALID_ARG, ESP_LOGE(TAG, "Endpoint cannot be NULL"));
|
||||
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;
|
||||
}
|
||||
|
||||
cluster_t *identify_cluster = identify::create(endpoint, &(config->identify), CLUSTER_FLAG_SERVER);
|
||||
identify::command::create_trigger_effect(identify_cluster);
|
||||
groups::create(endpoint, &(config->groups), 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());
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
} /* mounted_dimmable_load_control */
|
||||
|
||||
} /* endpoint */
|
||||
|
||||
namespace node {
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
#define ESP_MATTER_ON_OFF_PLUGIN_UNIT_DEVICE_TYPE_VERSION 3
|
||||
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_ID 0x010B
|
||||
#define ESP_MATTER_DIMMABLE_PLUGIN_UNIT_DEVICE_TYPE_VERSION 4
|
||||
#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_ID 0x010F
|
||||
#define ESP_MATTER_MOUNTED_ON_OFF_CONTROL_DEVICE_TYPE_VERSION 1
|
||||
#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_ID 0x0110
|
||||
#define ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL_DEVICE_TYPE_VERSION 1
|
||||
|
||||
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_ID 0x0302
|
||||
#define ESP_MATTER_TEMPERATURE_SENSOR_DEVICE_TYPE_VERSION 2
|
||||
@@ -805,6 +809,24 @@ 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);
|
||||
} /* secondary_network_interface */
|
||||
|
||||
namespace mounted_on_off_control {
|
||||
using config_t = on_off_config;
|
||||
|
||||
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);
|
||||
} /** mounted_on_off_control **/
|
||||
|
||||
namespace mounted_dimmable_load_control {
|
||||
using config_t = dimmable_light::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);
|
||||
} /** mounted_dimmable_load_control **/
|
||||
|
||||
} /* endpoint */
|
||||
|
||||
namespace node {
|
||||
|
||||
@@ -53,6 +53,8 @@ enum device_type_enum {
|
||||
ESP_MATTER_DEVICE_ENERGY_MANAGEMENT,
|
||||
ESP_MATTER_PUMP_CONTROLLER,
|
||||
ESP_MATTER_THREAD_BORDER_ROUTER,
|
||||
ESP_MATTER_MOUNTED_ON_OFF_CONTROL,
|
||||
ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL,
|
||||
ESP_MATTER_DEVICE_TYPE_MAX
|
||||
};
|
||||
|
||||
@@ -112,5 +114,7 @@ const device_type_name device_type_list[ESP_MATTER_DEVICE_TYPE_MAX] = {
|
||||
{"device_energy_management", ESP_MATTER_DEVICE_ENERGY_MANAGEMENT},
|
||||
{"pump_controller", ESP_MATTER_PUMP_CONTROLLER},
|
||||
{"thread_border_router", ESP_MATTER_THREAD_BORDER_ROUTER},
|
||||
{"mounted_on_off_control", ESP_MATTER_MOUNTED_ON_OFF_CONTROL},
|
||||
{"mounted_dimmable_load_control", ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL},
|
||||
};
|
||||
} /* namespace esp_matter */
|
||||
|
||||
@@ -519,6 +519,16 @@ int create(uint8_t device_type_index)
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case ESP_MATTER_MOUNTED_ON_OFF_CONTROL: {
|
||||
esp_matter::endpoint::mounted_on_off_control::config_t mounted_on_off_control_config;
|
||||
endpoint = esp_matter::endpoint::mounted_on_off_control::create(node, &mounted_on_off_control_config, ENDPOINT_FLAG_NONE, NULL);
|
||||
break;
|
||||
}
|
||||
case ESP_MATTER_MOUNTED_DIMMABLE_LOAD_CONTROL: {
|
||||
esp_matter::endpoint::mounted_dimmable_load_control::config_t mounted_dimmable_load_control_config;
|
||||
endpoint = esp_matter::endpoint::mounted_dimmable_load_control::create(node, &mounted_dimmable_load_control_config, ENDPOINT_FLAG_NONE, NULL);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
ESP_LOGE(TAG, "Please input a valid device type");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user