Easier method of distributing and installing custom code/components?

Greetings!

I’m very new to HASS but not to Python. First off, I’d like to thank all of the developers and contributors for an awesome project. The user experience of getting up and running was amazingly smooth, I was able to get HASS running and doing useful things really quickly, and the overall UX is great. From looking through the development docs, I’m really impressed on that side as well - the docs are amazingly thorough and the code seems really clean and modern, which is refreshing to see. So kudos to all of you!

Soon after getting HASS up and running I’ve been thinking about doing a bit of development for it… initially there are some changes I’d like to make to the ZoneMinder integration, and I’d also like to add some completely custom components.

I was really impressed with a lot of the internals of HASS, and specifically with how requirements are installed at runtime. But given all this, I was a bit let down when I found that there doesn’t seem to be any real way of sharing/distributing/installing custom components beyond “download this stuff and drop a bunch of files in your config directory” which seems like a bit of a burden for users, not to mention unless someone is doing this through a config management tool, it becomes unclear where each file came from, what version it is, whether it’s been modified, etc.

I couldn’t find anything about this on the forum or GitHub, but I was wondering if there’s been any discussion or planning around a more pythonic and user-friendly way of handling custom component installation?

One thought I had was to leverage setuptools entry_points since it seems that HASS already has existing pip/pkg_resources integrations. This would allow custom code to be distributed and managed as a normal Python package (i.e. either from PyPI or git, or manually installed locally) and then discovered and loaded automatically by hass just by being installed in the same venv. In theory, this could also be extended with a UI for managing custom component (“addon”? “plugin”?) installation/upgrade/removal via pip and some registry (PyPI, GitHub tags, or something manually curated).

I’d be willing to take a crack at a PR for this at some point if there’s interest and it fits with the views of the maintainers. I was just struck by the fact that the hass.io distribution/ecosystem has an official addon system, but for homeassistant itself the custom code forum seems full of “download this and copy all these files into your config directory”.

1 Like