Home Assistant Core on Android Tablet

I’ve worked through most of the issues getting HA up and running on a Galaxy A8. There is one error I am encountering when running hass.

Exception ignored in: <function Context.__del__ at 0xfed2331c0>
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/.homeassistant/deps/lib/python3.10/site-packages/pyudev/core.py", line 65 in __del__
    self._libudev.udev_unref(self)
AttributeError: 'Context' object has no attribute 'libudev'

This is with current latest version of homeassistant during the setup phase of running hass. I’m not sure if the exception is ok given it was ignored, or if it will lead to problems down the line.

Is this normal? or should I start over and take some extra steps?

1 Like

Hi, i’m following the guide of @deividAlfa but once I have uninstalled python 3.10 and installed the old version 3.9.7 I get stuck at the pip install --upgrade pip command.
I get an error about SSL. If I give the command pkg upgrade python is updated to 3.10, the upgrade pip command works but once I enter the last command I get the error cargo failed with code: 101 which depends on the python version bug.
I’ve tried everything but I’m stuck here and can’t resolve

1 Like

I met same question.

I never solved the SSL issue, but I’ve upgraded Python to 3.10 and it worked after a few tweaks: Home Assistant Core on Android Tablet - #96 by Gnoupi

So I would suggest pushing more in this direction, especially that it’s fully supported since 2022.7: 2022.7: A stunning performance - Home Assistant

I have now upgraded my setup to 2022.7, nothing breaking to note. There is a new dependency on orjson, which does not have wheels for our systems, and it’s relying on rust libraries, so there is more rust compilation to go through. It lasts a while, but it gets there in the end.

Remember to declare the build target variable for Cargo, so that the Rust build works:
export CARGO_BUILD_TARGET="$(rustc -Vv | grep "host" | awk '{print $2}')"

1 Like

Hi, I was following this guide to install HA on Nexus 7 (running Lineage OS Android 12) and Honor 7X (running Android 8) but after installing rust etc.
the installation got stuck (see attached screenshot) on both the devices exactly at same step.
Pls suggest a solution, thanks

@miriander How long did you wait?
It takes a loooooong time to build dependencies on the device, like half an hour to one hour.

If you want to be sure, open another terminal (from ssh on your computer for example so you don’t spend your time on the tablet), and run top or ps lx. You should see the processes which are hard at work.

Thanks for your prompt reply @Gnoupi
I waited for about an hr and the installation was successful. I m following this guide: https://github.com/alexanderhale/home-assistant#run
then I issued hass -v command and the result is attached.

But I am unable to open it on the phone itself using http://localhost:8123
Chrome says site not found

Also, what commands will I need to execute everytime I close and re-open Termux?

Congrats on making it this far, you’re halfway there!
Seriously, when home assistant starts, it will also run its own dependency retrieval for several of its components.

Which means you need to wait some more and monitor for potential issues in the log (or the console, since you launch it directly in the console in verbose mode).
“Domains to be set up” tells you it’s going to be setting up all those internal components. So you need to wait for this to happen. At this stage, if you look at processes, you will see the individual python processes installing the dependencies. Note that it might start deploying the web UI even before it finishes this. But it needs its essential components to achieve that. Either way, since it’s a first setup for you, I suggest waiting for everything.

Hopefully after some time it will manage to go through all the dependencies. If not, check what fails, try to install it manually in pip to check for errors, and refer to previous posts in this topic for hopefully a solution.

Once you are done with this, you can start thinking about proper ways to launch things automatically.
Personally I use a derivative of the one from the first post. A startup script for termux.boot looking this way:

#!/data/data/com.termux/files/usr/bin/bash

# prevent system from sleeping
termux-wake-lock

# enable remote access
sshd

# start MQTT in the background
mosquitto -d -c /data/data/com.termux/files/usr/etc/mosquitto/mosquitto.conf

# start home assistant in the background
source ~/hass/bin/activate
daemonize /data/data/com.termux/files/home/hass/bin/hass
deactivate

That said it has been explained in a previous post that I’m not using daemonize exactly properly, so it launches it in background it doesn’t really do what it should. A better way would be to follow this post: Home Assistant Core on Android Tablet - #75 by pure_evil

@Gnoupi - Isnt it properly installed without any errors? Pls check the last 2-3 lines of above screenshot.
But unable to connect to server using chrome on mobile.
pls see attached screenshots.

Also, I am unable to DM u. is there a quick way to reach out to u? whatsapp/email?

In my case I just run hass -v several times until it starts to spit out error message instead of end after the “domain to be set up” part.

@wspruce - Thanks for your reply. I tried multiple times and was able to move forward. Now again stuck. Pls see attached screenshot I have merged two Screenshots together. how long does installing of PyTurboJPEG takes and how to solve the error?

@miriander Numpy is causing issues for some people. Please check previous messages in this topic, maybe something will help.
My last encounter with it showed an issue between the latest version of it and its inability to link to the proper math library with Termux: Home Assistant Core on Android Tablet - #96 by Gnoupi

See if it helps.

In general, still the same approach. Launch hass -v, give it time (especially on an old device), wait for errors, see that it still works by checking active processes. When you encounter an error, check in this topic for similar errors on the same libraries, try to apply fix. If it does not work, take it to google and see if someone reported the same kind of error. If you find a new fix, please post here to help other people.

Remember it’s not an easy way to deal with HA. You’re exposed to all dependency issues, and often have to find fixes.

You are very near to the success!
Each error message is related to a failed installation of a python library. And it uses a SyncWorker so you can’t see the log in real time which is annoying.
So what I did is:

  1. press ctrl-C to abort the initilization every time I saw a error.
  2. Identify the library that failed to be installed. In your screenshot it’s numpy.
  3. Google “termux install [library name]” for the solution.
  4. After every installation of library, run hass -v again, hopefully you can see it make some progress with “the list” and a new error message.
  5. back to 1.

Good luck!

@wspruce and @Gnoupi : thanks for your replies.
I am not able to figure out the problem here: Pls help me. Also, pls check line #5 as per which NumPy is installed.

I can’t tell exactly but maybe try install libjpeg-turbo and pyturboJPEG manually?

Installed libjpeg-turbo & pyturboJPEG using pip install and
I have reached here now: hass error 2 - Pastebin.com
@wspruce

Looks like scapy (a networking library) has issues with rights. It’s a common thing when it’s used without root access (which we do not have, since we use termux). That said, it’s the first time I see such error.
I’ve also updated to the latest version this morning and did not experience that.

Out of curiosity, did you try to change the port you want the web interface to run from? Asking because operating on ports below 1024 usually requires higher permissions. It’s a long shot, but just in case.

Not have many idea about this. I didn’t have any permission problem.
BTW I did everything through ssh instead of on the phone, if that makes any change.

How did you do the whole process?
Current, on my Nexus 5 (obviusly rooted + Lineage OS) I can’t even install Termux.
To speak correctly, Termux won’t install itself properly (I think).
I’m using Nexus Root Toolkit to try some Termux apk, but I can’t execute pkg and other commands cause it says it couldn’t find them.
Same result with other terminal-like app.
So I can’t install python, and go further.

If you did it, it’s a proof that it can be done on Nexus 5

@ Gnoupi please help