Editing Component Files in Hassio

Does anyone know how to edit files associated with a specific component in Hassio? For example, I am trying to modify a few lines in a file related to the iCloud component but can’t seem to locate the file anywhere in the terminal when I ssh into Hassio. Any help would be appreciated.

Modify a library inside python dev is realy bad practics. Use custom component for that and that work also inside hassio.

Had this yesterday with a function that was broken in the latest update and the great man himself, @balloob, pointed me in the right direction.

Copy the file you want to edit into the custom_components folder but make sure you recreate the folder path inside that folder, for example, I needed to edit harmony.py which is here…


…so I added /config/custom_components/remote/harmony.py

If you get errors about not finding other files in your new folder just copy them into it too. You can get the files from the homeassistant github, I couldn’t see how to download them so just copied the code and pasted into a new file, saving with the relevant name.


I’m trying to fix the foscam issue since 51.2 is not out yet for hassio.
I use the ssh addon but cannot find the folder: /usr/lib/python3.6/site-packages/homeassistant/components
Am I looking in the wrong location?

This is a good simple tip that should be part of hass.io docs.
There are a lot of people who have customisation in their hass solution who are disappointed that hass.io is not flexible enough for them.

This is a nice solution as it decouples customisation from the core hass image, so allows you to see exactly what has been changed.


@redwings15 :
SSH on port 22222 instead of 22 and you’ll be logged in the “container manager”.
Then you can do ‘#docker ps’ to list the containers.
If you want to log in into a container => example : ‘#docker exec -t -i homeassistant /bin/bash’
To get info about a container : ‘#docker inspect homeassistant’

If you change something inside a container, it will be lost after restart that’s why you have to use a shared folder with the “base image” which is persistent.


As you say, it’s not a good practice to make edits in the docker image.
Better to get used to using custom_components folder.

Thanks! Where do I put this custom_components folder? Since I’m using Hassio I have access to 4 folders… addons, backup, config, and share, but I don’t see a custom components folder and don’t know where to put it either.

It goes in the config dir:


1 Like

Perfect thanks!


1 Like


Im completely new to HA (Hass) but not to home automation:slight_smile:

Maybe this is a easy one but how do you find and copy the harmony.py (In this case) file over to custom_components if we dont have access to the components folder in Hass?

Or Is this not possible on hass.io


Hi there, I have a similar problem under Hassio, which this post has helped with. In my case I fixed a couple of issues with the “russound_rnet.py” component, under media_player. I can see that HASS is now using the patched code under “config/custom_components/media_player”. the file “russound_rnet.py” has a REQUIREMENTS = [‘russound==0.1.7’], which is a file called “russound.py”, normally under “.homeassistant\deps\Python36\site-packages\russound”, that I have not been able to locate in Hassio. Can you guys help me, by telling me where this Requirement file should go in Hassio?

Thanks in advance.

I’m trying to do the same with https://github.com/easink/hass.aioheos.media_player but I don’t seem to get the requirements fixed either… Normally with python, dependencies can just be put in the same folder and they will be recognized when importing, but this doesn’t seem to work.

@Bobby_Nobble would this work for the zwcfg_xxx.xml file? Im trying to edit it for the Central scene fixes but it keeps over writing it because i cant get HA to stop correctly.

Sorry, don’t know about that one. Do a backup and then give it a go, nothing to lose of you’re prepared for the worst :+1:

@bobby_nobble thanks for the reply. I figured out what I needed to edit the xml file. just needed to update the SSH add-on. All is good now.

1 Like

I was able to override an included file by doing the following. In my case I needed to override some code in the /usr/lib/python3.6/site-packages/pysma/__init__.py file which is used in the sma sensor. To do this I copied those files into the custom_components directory like so


And then in the sma.py file I found where pysma was imported and changed the code from

import pysma
import custom_components.pysma as pysma

After I did this everything started working.

1 Like