Editing Component Files in Hassio

@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.

3 Likes

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:

config/custom_components

1 Like

Perfect thanks!

https://home-assistant.io/developers/component_loading/

1 Like

Hi

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

https://github.com/home-assistant/home-assistant/blob/master/homeassistant/components/remote/harmony.py

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

/config/custom_components/sensor/sma.py
and
/config/custom_components/pysma/__init__.py

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

import pysma
to
import custom_components.pysma as pysma

After I did this everything started working.

1 Like

Connection refused on port 22222

Have tried to follow https://home-assistant.io/developers/hassio/debugging/ but no luck so far

Thx all, this worked like a charm!

SInce Version 107.x the source files in the docker container are located at /usr/src/homeassistant

1 Like

Second this. Thanks to all of you.

Just remember, if you copy the integration from core to custom_components, you have to add a dummy version in the manifast file. Otherwise it is not loaded anymore, due to recent changes in core.

2 Likes

How it‘s possible to make changes in the manifest? I’m searching for hours now :-/

You can take more or less any text editor of your choice.