Home Assistant on OpenWrt device


#1

Hi,
I am working to integrate the home assistant on a OpwnWrt device,
Currently I could run the home assistant inside Venv on my device,
I have issue with the discovery similar to the issue here
I have no gcc on the platform but I did cross compiled netifaces and netdisco from here
I set include-system-site-packages = true, and if I run Python3 I can import the netifaces/netdisco and use them

But running Hass try to install the netdisco with pip and does not use the installed one

Any suggestions, how can I force hass to use the already installed libraries?

Regards,
Boaz


#2

solved:
copied manually the netifaces.cpython-36.so to
homeassistant/lib/python3.6/site-packages/
Also installed the netifaces on Ubuntu and got the netifaces-0.10.4.egg-info directory from there.
Then:
pip install netifaces==0.10.4 returns:
Requirement already satisfied: netifaces==0.10.4 in ./homeassistant/lib/python3.6/site-packages


#3

That is amazing!. I hope you’ll succeed. I’m very interesting in this and I’ll follow you.


#4

Could you give more detail about the installation on Openwrt ?

I am currently stuck at :

Error: Command ‘[’/root/homeassisant/bin/python3’, ‘-Im’, ‘ensurepip’, ‘–upgrade’, ‘–default-pip’]’ returned non-zero exit status 1.

/root/homeassisant/bin/python3 -m ensurepip --upgrade --default-pip
/root/homeassisant/bin/python3: No module named ensurepip

python3 --version
Python 3.6.0

Did you use custom packages ? Are you using a special platform ?


#5

I managed to get the python virtual environment going with

pip3 -v install virtualenv
virtualenv -p python3 .
. bin/activate

As mentioned above some installation fails : netdisco and warrant . The dependent component can be removed from the configuration to avoid delay in startup time.


#6

Hi,
Netdisco can be cross compiled to the platform you are using , then discovery will work,
I could run the home assistant on my platform ,
For any non native python langauge I had to cross compile it and then copy the compiled version into the virtual enviroment folder.


#7

Did you build your own OpenWRT image to install HA and if so, wich components did you select before making?


#8

Hi,

Yes I build my own version with python, and then run HA over it.
I added python from packages/lang/python/ and then I needed to update some libraries like bzip2 and xz before compiling
After that in the menuconfig you should see the python package,


#9

Thanks for your reply. I tired it myself today but I got stuck when pip tries to install bcyrpt.
So I’m not quite sure how this works.

I also tried it with DD-WRT wich also uses Opkg. There I can’t even create the virutal env:
" Running virtualenv with interpreter /opt/bin/python3. Please use the system python to run this script"


#10

It seems that Bcyrpt is not a pure python package, so you will need to cross compile it and then manually copy the binary to the venv folder. You can check that pip install is showing that this is already installed.


#11

you can check this topic, managed to install it on my router