I understand the reasons why custom component support was removed, as outlined here.
But I feel that these reasons are mostly targeted towards “proper” components that are meant to be distributed to other users, and in those case, yes, external components are much better.
However.
These reasons are meaningless for people that have existing projects using custom components. They, like me, found or wrote some code somewhere in the past that works, and has been working for a long time. And now they can’t compile their projects anymore.
If you didn’t write it yourself, the original writer of the code may have long since moved on, and given that this wasn’t really a proper component in the first place, probably just shared code that worked for them, in the hope that it would work for others. They probably never intended this to be a proper component.
The users of the code can follow instructions very well, and got it working, but that’s about it. They aren’t programmers. They can’t be expected to rewrite the custom component to an external one. I’ve seen many posts popping up the last couple of days from people asking why their project, with custom components, doesn’t compile anymore, and how to fix it.
And I guess that’s the main issue here: there isn’t a trivial fix. We can’t tell people to “just move that C++ code to a separate file”, and it’ll work, because it won’t.
Side note: I’ve recently implemented my first external component, and even though I’m a seasoned software developer, it was difficult. With the removal of custom components the documentation for external components has somewhat improved, but not nearly enough to make it a reasonably easy process (I still don’t understand half of what the Python part of my component does, I just lifted code from existing components and it seemed to work
).
It feels like there’s a mismatch between the purpose of external components on one side, and custom components on the other, that perhaps hasn’t been given enough thought.
External components are meant to be shared with other users and could even end up as part of ESPHome itself. They are “proper” components, and therefore, they have strict rules on implementation, validation, etc.
Custom components are quick-and-dirty: they lack the safeguards that external components provide, but they often get the job done much quicker, don’t require as much programming/development skills, and are often a good solution for personal projects. They get shared with other users, but usually with a “this may not work for you as well as it does for me” guarantee. But they do work, are they are being used.
Removing support for custom components has left a void in the “getting things done quickly” category, and has also left a lot of users with projects that now cannot be compiled anymore, and that a lot of them cannot fix.
EDIT: I took the custom component code from ESPHome 2024.10.0 and created an external component for it (yes, I can see the irony here
). It might be enough to enable custom components in 2025.2.0 again (I tried against the one project that I have that requires custom component support, and it compiles). See here: GitHub - robertklep/esphome-custom-component: Brings back support for custom ESPHome components