Home Assistant Core on Android Tablet

i have the same problem could you solve it

Google seems to point at updating your packages in termux (assuming that’s what you use):

Try a little pkg upgrade?

yes but command “pkg update” update python 3.9 to python 3.10 and the problems return

yes but it doesn’t work, I’m trying to install home ass on android with termux and it seems that the python version is the problem, I have searched and tried many solutions on google but they don’t work, sorry I’m a newbie, thanks .

Try to prevent to upgrade python or problematic packages with apt-mark hold <package-name>

After a tablet reboot I started having the SSL problem as well, so I just went on to follow my own advice and upgraded everything, which resulted in having python 3.10 (and apparently losing majority of my preinstalled packages).

(hass) ~ $ python --version
Python 3.10.4

I’ve encountered several errors and managed to work through them. Some known already:

  • lack of timezone info (pip install tzdata)
  • inability to build cryptography (installing the rust and cargo dependencies and setting the CARGO_BUILD_TARGET variable fixed that)

In new stuff, I got issues with numpy, which apparently currently does not recognize the proper math library on Termux. It’s identified already, and there is a workaround: [Bug]: Unable to install python module numpy in termux · Issue #10808 · termux/termux-packages · GitHub

MATHLIB=m pip install numpy

So after that, I have Home Assistant 2022.5.5 running, seems to be ok so far. So it looks like we can make it work on 3.10, at least with the services I’m using.

2 Likes

Is root compulsory to run this on android device or can it be installed on more recent and up to date android devices.

For example, you can easily sideload F-Droid to an NVIDIA Shield TV Pro, install termux and go from there using a keyboard remote or the shield TV remote app on your phone, resolving errors as listed throughout the thread. I did get it to the point of manually starting hass and then went on a long holiday before finishing off the project. Needless to say I forgot where I got to and will probably have to start again, but does starting the daemon on reboot require root ?

Simple Termux here, no particular elevated access.
I use termux-boot to launch the script on startup (pretty much same as in the first post under “Startup at Reboot”).

Thanks, worth pursuing then

I followed the guide to have it working on my Samsung S9.
For each new service, i currently have to observe the hass output to see which python packages it is trying to install and then install them manually because hass is failing to install them as it is trying to put them in the wrong location on disk. This is an example error when trying to add Google Nest:
2022-07-07 01:17:02 ERROR (SyncWorker_3) [homeassistant.util.package] Unable to install package python-nest==4.2.0: ERROR: Could not install packages due to an OSError: [Errno 30] Read-only file system: ‘/lib/python3.10’
Anyone know how to solve?

ok so solved this issue by using a virtualenv for installing homeassistant into. If I install it in the base env, I get the above errors.

1 Like

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?