Where is home assistant source in Hass.Io

I’ve been using HA for a while, originally via Hassbian. But I had an SD card fail and just reinstalled using Hass.io.

Where has the source code gone?
I SSH in and I cannot find any of the python libraries, component sources in a path such as
/usr/lib/python3.6/site-packages/homeassistant/components/

I cant even do a find for files I know exist.
I want to copy a component to a local custom_components folder to do some hacking.

custom_components goes under your config directory, which is /config.

Ooops I see what you mean, you want to copy an existing component there to change it.

Use HA Github

try /usr/local/lib

not there either…

Oh crap… actually it IS but it’s in the container for HA not in the root O/S of course Duh!

I am running hassio virtual image in virtualbox. I am logging in with the ssh & webterminal addon (not the straight ssh one). There is a whole lot of stuff under /usr/local/lib/python3.7/site-packages

However on closer inspection it certainly isn’t all of what @jasebob wants. That we be in another container. Probably is easiest to fetch from github.

Yeah I found the packages in the Home Assistant container… not the ssh community addon one… but yeah probably far easier to get them from github. There’s a chrome github addon that lets you select a folder and then you can download the whole folder as a zip file which alleviates the PITA of github downloads for multiple files.

or just git clone and copy what you need.

Hmm, not sure if I understand the different container. Can I log into that via a different SSH session? Or maybe just mount something to see it?

The issue is that I may not always be at the latest release, I might want to work with the fileset in my current install. And nothing is easier than cp -a. :slight_smile:

The best you can do is learn docker commands.

Exec into the container, cp the files over to the correct directory.

Or

As suggested already you can easily automate it with git.

Thanks for the help thus far.
I have got into Docker and managed to copy the components I want into custom_components folder. Details are at the bottom of this message for others to follow.

The whole point of this is to allow me to debug the Bose SoundTouch Component which is not very reliable and not being actively maintained. So I copied components/soundtouch and its dependency libsoundtouch to the custom_components folder.

But its not loading, which I base on

  • I don’t get any message from homeassistant.loader warning me about the custom override
  • I don’t get any logger.info messages I insert into the copied code

I have another custom component, a fix for velux component by @gibman which is working fine.

  • I do get the warning message from homeassistant.loader for this

I don’t see anything different about file ownership or permissions compared to the velux component

core-ssh:/config/custom_components# pwd
/config/custom_components
core-ssh:/config/custom_components# ls -l
total 16
drwxr-xr-x    4 root     root          4096 May 23 03:55 libsoundtouch
drwxr-xr-x    4 root     root          4096 Jun 16 14:41 pyvlx
drwxr-xr-x    3 root     root          4096 Jun 16 21:02 soundtouch
drwxr-xr-x    3 root     root          4096 Jun 16 14:41 velux
core-ssh:/config/custom_components#

From here I am kind of stumped. Any advice on how to debug this would be appreciated.


Here’s how I copied a released component into custom_components folder. This is specific to Hass.Io.

Follow this https://developers.home-assistant.io/docs/en/hassio_debugging.html#hassos-based-hassio
Which can be summarized as:

  1. Create a formatted USB stick with the volume name CONFIG.
  2. Copy authorized_keys to the root
  3. Insert into rasberry pi
  4. In HA, Hassio menu=>system tab=> import from USB

Now login like this

ssh root@<YOUR_IP> -p 22222

You get the hassio command line interface. To get to bash

login
docker exec -it homeassistant /bin/bash

Now you can find HA packages installed here

/usr/local/lib/python3.7/site-packages/
/usr/local/lib/python3.7/site-packages/homeassistant/components/

And do something equivalent to this

cp -a /usr/local/lib/python3.7/site-packages/homeassistant/components/soundtouch /config/custom_components/
cp -a /usr/local/lib/python3.7/site-packages/libsoundtouch /config/custom_components/

noting that the only reason for the 2nd copy is that libsoundtouch is a dependancy for the soundtouch component I am interested in playing with.

4 Likes

So I tried this procedure with a simpler component (https://www.home-assistant.io/components/filter/), with the same result.There must be something wrong with my procedure.

I suspect you wanted to put this in a new thread, or somewhere else.

Or you just wanted the necro post of the day award :slight_smile:

Ooops, that was akward. thanks for the heads up.

1 Like

So is this still a thing to access the components folder? That link no longer works.

What link, you didn’t reply to any particular post.

What are you trying to do?

The link in the instructions for the thing that the post is about :slight_smile:

No because that is a dead link. Pretty much the same info is here Debugging the Home Assistant Operating System | Home Assistant Developer Docs

However you may find this add-on is easier

1 Like

Cool :slight_smile: Thanks Nick

1 Like