Can I inherit ESP32 Camera component?

Is there a way to extend the ESP32 Camera Component?

In a nutshell, the ESP32Camera is a C++ class. So, in theory I can create a new ESPHome component, which C++ part can be a class with ESP32Camera as a parent.

But I’m completely struggling with a Python part of a new component. I looked at the BME280, Climate ID component sources and tried to define an file. Unfortunately without any success.

Where am I wrong?

import esphome.codegen as cg
from esphome.components import esp32_camera

#import esphome.config_validation as cv
#from esp32_camera import CONFIG_SCHEMA as CONFIG_SCHEMA_BASE
#from ..esp32_camera.__init__ import to_code as to_code_base, cv, CONFIG_SCHEMA as CONFIG_SCHEMA_BASE

AUTO_LOAD = ["esp32_camera"]

esp32_camera_detector_ns = cg.esphome_ns.namespace("esp32_camera_detector")
DetectorComponent = esp32_camera_detector_ns.class_("ESP32CamDetector", esp32_camera.ESP32Camera)

CONFIG_SCHEMA = esp32_camera.CONFIG_SCHEMA.extend(

async def to_code(config):
    await esp32_camera.to_code(config)
#pragma once
#ifdef USE_ESP32
#include "esphome/components/esp32_camera/esp32_camera.h"

namespace esphome {
namespace esp32_camera_detector {

class ESP32CamDetector : public esphome::esp32_camera::ESP32Camera {
    ESP32CamDetector() : ESP32Camera() {}

}  // namespace esp32_camera_detector
}  // namespace esphome

#endif  // USE_ESP32