Add EVSE device type with delegate

This commit is contained in:
Rohit Jadhav
2024-05-09 15:05:00 +05:30
parent d2912848b3
commit 34fd0a569a
16 changed files with 611 additions and 2 deletions
@@ -44,6 +44,7 @@ enum device_type_enum {
ESP_MATTER_ELECTRICAL_SENSOR,
ESP_MATTER_OVEN,
ESP_MATTER_COOKTOP,
ESP_MATTER_ENERGY_EVSE,
ESP_MATTER_DEVICE_TYPE_MAX
};
@@ -93,6 +94,7 @@ const device_type_name device_type_list[ESP_MATTER_DEVICE_TYPE_MAX] = {
{"rain_sensor", ESP_MATTER_RAIN_SENSOR},
{"electrical_sensor", ESP_MATTER_ELECTRICAL_SENSOR},
{"oven", ESP_MATTER_OVEN},
{"cooktop", ESP_MATTER_COOKTOP}
{"cooktop", ESP_MATTER_COOKTOP},
{"energy_evse", ESP_MATTER_ENERGY_EVSE}
};
} /* namespace esp_matter */
@@ -404,6 +404,21 @@ int create(uint8_t device_type_index)
endpoint = esp_matter::endpoint::cooktop::create(node, &cooktop_config, ENDPOINT_FLAG_NONE, NULL);
break;
}
case ESP_MATTER_ENERGY_EVSE: {
esp_matter::endpoint::energy_evse::config_t energy_evse_config;
endpoint = esp_matter::endpoint::energy_evse::create(node, &energy_evse_config, ENDPOINT_FLAG_NONE, NULL);
esp_matter::endpoint::power_source_device::config_t power_source_config;
esp_matter::endpoint_t *ps_endpoint = esp_matter::endpoint::power_source_device::create(node, &power_source_config, ENDPOINT_FLAG_NONE, NULL);
esp_matter::endpoint::electrical_sensor::config_t electrical_sensor_config;
esp_matter::endpoint::electrical_sensor::add(ps_endpoint, &electrical_sensor_config);
if (!ps_endpoint) {
ESP_LOGE(TAG, "Matter create endpoint failed");
return 1;
}
break;
}
default: {
ESP_LOGE(TAG, "Please input a valid device type");
break;