Installing custom python packages edits

I’m trying to figure out if/how to change the code in a pypi python packge.

I have a lutron setup, and unforunatly the upstream maintainer hasn’t incorporated the pull request to detect my system. On a non-hass.io install, I can directly edit the files in /usr/local/lib/python3.7/site-packages/pylutron.

For Hass.io, I’ve tried creating these changes in varios paths such as <CONFIG>/custom_components/pylutron but can’t figure out the right magical incantation yet.

Is there a way? I’m even willing to ssh in/edit files in hacky terrible ways every time I upgrade at this point. I’m hoping that the upstream will be fixed soonish, but I’ve been hoping for a few months now so in the meantime want to hack and slash my way to working.

If you really wanted to hack it in, you’d have to get access to the host OS and then exec into the HA docker container and modify the files there. Any updates will most likely wipe out those changes.

Otherwise, I’m guessing the way to do it would probably be to copy the lutron component to your custom_components and modify the requirements in manifest.json to use a “fixed” version of pylutron. If there’s a branch or PR with the fix then you might be able to use that. Otherwise, you might need to fork it yourself and make the changes in your fork and then reference that. I’m not sure what the syntax is for that or if it’s really possible without making a release on pypi, but I think I’ve seen something like that before.

According to the documenation, the requirements are just pip compatible strings, so you should be able to find examples of what URL to use for directly getting the code from github or possibly even your <CONFIG> folder if you want to download the pylutron code and keep it in there.

Thanks @tboyce1, that’s along the lines of what I’m thinking. I’ve tried already doing the custom component, copying the Lutron one, etc. I’m missing the specific incantation and the debugging is tough as I can’t see any output anywhere.

I’ll play around some more, and maybe post a sample code snippet after banging on it some.

From what I understand you’d have to modify the docker image of HassIO and inject your altered version of the python library.

i added Ra2 to HASSIO, but the devices show up on the dashboard without a Unique ID, so i can’t add them to rooms or anything.

can you help with that?