How to debug an ESPHome component

I found a problem with one of the ESPHome components (teleinfo) and I reported it in the issue tracker. But I would also like to try to debug and maybe solve it myself.
Can this be done on a Hass.io installation?

I read that ESPHome has a custom_components mechanism. So I created a sub-path /config/esphome/custom_components/teleinfo/ and placed the .h and the .cpp file of the original component there to edit it and i.e. insert logger commands. But my files are ignored. ESPHome still users it’s original files.

Is there a way to do this?

You should also put all .py files of original component

OMG, so simple!
I had copied the files from the directory that ESPHome creates at compile time. But these folders do not contain the .py files.

I have now checked out the Git repo and used the complete component files from there. Works like a charm now.

Thanks for pointing me in the right direction!