Custom component development options

I would like to use a specific sensor not yet implemented by ESPHome.
I understand that I have at least two options:

  • Generic Custom Component: This integration can be used to create generic custom components in ESPHome using the C++ (Arduino) API.
  • External Components: You can easily import community or personal components using the external components feature.

I started with the first one but it seems somehow limited (for instance I am getting errors when I try to include other C++ classes).

Can you confirm that the second option is presently the most suitable to do this kind of new developments?

Regards

Could someone just point which one of this two options is the most suitable for developing custom components?

I remind that with the Generic Custom Component — ESPHome method we have to include a custom_component section (with some lambda code) in the yaml file and include an C++ .h file following the several examples in the docs. By the way, I already solved the problems I had with the inclusion of others libraries.

I still not tried the External Components — ESPHome method, but it seems more general since besides de C++ code I also find some .py code that seems to help the Home Assistant integration. It is a pity, this method is much less covered in the docs!

Regards

Sorry for being a bit late
What will you like to be implementing? a sensor, switch
the best docs I have found for custom sensor but the same principles can be applied for others