Integrations required to be on pypi?

Hello,

Looking for guidance from someone who can explain the following requirement for integrations in Development Checklist | Home Assistant Developer Docs

All communication to external devices or services must be wrapped in an external Python library hosted on pypi.

I’m working on an integration, currently on HACS, that I would like to one day merge into HA core. The integration is based on a raw socket protocol using documentation from the vendor of the device. The connection is bidirectional and very stateful, requiring correct sequencing of commands etc. The communication is done through the asyncio socket functionality.

Does this requirement mean that in order to be accepted, I would need to refactor the code to have a separate repo dedicated to just the socket connection? It would be very difficult for someone to make anything standalone that would be able to use the socket connection, so it would be kind of useless other than to satisfy the HA requirements.

Any info would be appreciated, thank you!

Yes, the vast majority of integrations are made up of two parts - an external library that takes care of the heavy-lifting communication with the device or service, and then some glue code inside the HA repository that makes sense of the data retrieved through the external library and turns that into entities. The reason for this approach is to keep the HA code base manageable

The exceptions are things like templates, helpers or statistics - none of which are communicating with external devices or services.

Maybe you can try to find a similar integration in the current HA codebase for some inspiration on how to refactor your code?

Thank you for your answer. I will refactor :slight_smile:

1 Like