mirror of
https://github.com/espressif/esp-matter.git
synced 2026-04-27 19:13:13 +00:00
Add Oven device type
This commit is contained in:
@@ -65,3 +65,4 @@ i. Appliance
|
|||||||
3. Room Air Conditioner
|
3. Room Air Conditioner
|
||||||
4. Refrigerator
|
4. Refrigerator
|
||||||
5. Temperature Controlled Cabinet
|
5. Temperature Controlled Cabinet
|
||||||
|
6. Oven
|
||||||
|
|||||||
@@ -1445,6 +1445,44 @@ esp_err_t add(endpoint_t *endpoint, config_t *config)
|
|||||||
}
|
}
|
||||||
} /** refrigerator **/
|
} /** refrigerator **/
|
||||||
|
|
||||||
|
namespace oven {
|
||||||
|
|
||||||
|
uint32_t get_device_type_id()
|
||||||
|
{
|
||||||
|
return ESP_MATTER_OVEN_DEVICE_TYPE_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t get_device_type_version()
|
||||||
|
{
|
||||||
|
return ESP_MATTER_OVEN_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);
|
||||||
|
|
||||||
|
return ESP_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
} /** oven **/
|
||||||
|
|
||||||
namespace robotic_vacuum_cleaner{
|
namespace robotic_vacuum_cleaner{
|
||||||
|
|
||||||
uint32_t get_device_type_id()
|
uint32_t get_device_type_id()
|
||||||
|
|||||||
@@ -102,6 +102,8 @@
|
|||||||
#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1
|
#define ESP_MATTER_RAIN_SENSOR_DEVICE_TYPE_VERSION 1
|
||||||
#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID 0x0510
|
#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_ID 0x0510
|
||||||
#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION 1
|
#define ESP_MATTER_ELECTRICAL_SENSOR_DEVICE_TYPE_VERSION 1
|
||||||
|
#define ESP_MATTER_OVEN_DEVICE_TYPE_ID 0x007B
|
||||||
|
#define ESP_MATTER_OVEN_DEVICE_TYPE_VERSION 1
|
||||||
|
|
||||||
namespace esp_matter {
|
namespace esp_matter {
|
||||||
|
|
||||||
@@ -598,6 +600,17 @@ 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);
|
esp_err_t add(endpoint_t *endpoint, config_t *config);
|
||||||
} /** refrigerator **/
|
} /** refrigerator **/
|
||||||
|
|
||||||
|
namespace oven {
|
||||||
|
typedef struct config {
|
||||||
|
cluster::descriptor::config_t descriptor;
|
||||||
|
} 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);
|
||||||
|
} /** oven **/
|
||||||
|
|
||||||
namespace robotic_vacuum_cleaner{
|
namespace robotic_vacuum_cleaner{
|
||||||
typedef struct config {
|
typedef struct config {
|
||||||
cluster::descriptor::config_t descriptor;
|
cluster::descriptor::config_t descriptor;
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ enum device_type_enum {
|
|||||||
ESP_MATTER_POWER_SOURCE,
|
ESP_MATTER_POWER_SOURCE,
|
||||||
ESP_MATTER_RAIN_SENSOR,
|
ESP_MATTER_RAIN_SENSOR,
|
||||||
ESP_MATTER_ELECTRICAL_SENSOR,
|
ESP_MATTER_ELECTRICAL_SENSOR,
|
||||||
|
ESP_MATTER_OVEN,
|
||||||
ESP_MATTER_DEVICE_TYPE_MAX
|
ESP_MATTER_DEVICE_TYPE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -87,6 +88,7 @@ const device_type_name device_type_list[ESP_MATTER_DEVICE_TYPE_MAX] = {
|
|||||||
{"water_leak_detector", ESP_MATTER_WATER_LEAK_DETECTOR},
|
{"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},
|
{"rain_sensor", ESP_MATTER_RAIN_SENSOR},
|
||||||
{"electrical_sensor", ESP_MATTER_ELECTRICAL_SENSOR}
|
{"electrical_sensor", ESP_MATTER_ELECTRICAL_SENSOR},
|
||||||
|
{"oven", ESP_MATTER_OVEN}
|
||||||
};
|
};
|
||||||
} /* namespace esp_matter */
|
} /* namespace esp_matter */
|
||||||
|
|||||||
@@ -315,6 +315,23 @@ int create(uint8_t device_type_index)
|
|||||||
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
|
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case ESP_MATTER_OVEN: {
|
||||||
|
esp_matter::endpoint::oven::config_t oven_config;
|
||||||
|
endpoint = esp_matter::endpoint::oven::create(node, &oven_config, ENDPOINT_FLAG_NONE, NULL);
|
||||||
|
|
||||||
|
esp_matter::endpoint::temperature_controlled_cabinet::config_t temperature_controlled_cabinet_config;
|
||||||
|
esp_matter::endpoint_t *tcc_endpoint = esp_matter::endpoint::temperature_controlled_cabinet::create(node, &temperature_controlled_cabinet_config, ENDPOINT_FLAG_NONE, NULL);
|
||||||
|
|
||||||
|
if (!tcc_endpoint) {
|
||||||
|
ESP_LOGE(TAG, "Matter create endpoint failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_matter::cluster_t *cluster = esp_matter::cluster::get(tcc_endpoint, chip::app::Clusters::TemperatureControl::Id);
|
||||||
|
cluster::temperature_control::feature::temperature_number::config_t temperature_number_config;
|
||||||
|
cluster::temperature_control::feature::temperature_number::add(cluster, &temperature_number_config);
|
||||||
|
break;
|
||||||
|
}
|
||||||
case ESP_MATTER_AIR_PURIFIER: {
|
case ESP_MATTER_AIR_PURIFIER: {
|
||||||
esp_matter::endpoint::air_purifier::config_t air_purifier_config;
|
esp_matter::endpoint::air_purifier::config_t air_purifier_config;
|
||||||
endpoint = esp_matter::endpoint::air_purifier::create(node, &air_purifier_config, ENDPOINT_FLAG_NONE, NULL);
|
endpoint = esp_matter::endpoint::air_purifier::create(node, &air_purifier_config, ENDPOINT_FLAG_NONE, NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user