Homeassistant core on Android (Guide Dec'22)

I described the path to the configuration file and how to edit it in this comment:

I’m afraid that this requires Android 7.
You can try installing LineageOS instead of a regular android. (if you install a newer version of android, I do not recommend setting the version higher than 9. Starting with Android 10, Google has tightened security and limited access to the /proc folder. Because of this, the server and some ignores may not work correctly)
Or install a virtual machine with Linux and install a server on it. (But running on a virtual machine will be much slower. I had a difference in server startup speed of 10 minutes instead of 10 seconds)

1 Like

Hi, me too have the same problem, do you find a solution?
Thanks in advance

1 Like

Hi, Right now I`m trying to install haas on my phone, but facing with exect problem. How did you fixed that?

I just waited, I put the installation command and went to help my dad with something I came back after like an hour and it was installed.

I added this automation:

alias: Restart server by socket errors
description: ""
trigger:
  - platform: event
    event_type: system_log_event
condition:
  - condition: template
    value_template: >-
      {{ "BaseSelectorEventLoop._accept_connection" in
      trigger.event.data.message[0] }}
action:
  - service: homeassistant.restart
    data: {}
mode: single

That is, as soon as the server detects such an error message in the log, it restarts.

But for automation to work, you need to enable system log events in the configuration file:

system_log:
  fire_event: true
2 Likes

Hi,

Thanks for steps, it is very nice, I am new to here
I try on this but seems not work anymore, do you think is the new version of hass problem?

ERROR: Could not build wheels for lru-dict, which is required to install pyproject.toml-based projects

Anyone try a clean install and done?

1 Like

lru-dict isn’t compatible with python 11 yet, but I found a fix that was only posted yesterday so it isn’t in the main branch yet. I was able to install with this:

pip install git+https://github.com/amitdev/lru-dict@5013406c409a0a143a315146df388281bfb2172d

Home Assistant 2023.4.1 on an Amazon Fire TV Cube now launches, however the next hurdle is ha-av, which is incompatible with ffmpeg v6 (issue posted here https://github.com/home-assistant/core/issues/90994 )

1 Like

CFLAGS=-Wno-incompatible-pointer-types pip install lru-dict

Found an other solution here

2 Likes

Do not use this - although it compiles, it may segfault. I was the original poster of the above.

A better solution is to use @jambalaya’s fix:


I have managed to get ffmpeg 5.1.2 built and working with ha-av by cloning the termux-package repo at 619095bbd0307851a7767b78e572ae22d8649e0bGitHub - termux/termux-packages at 619095bbd0307851a7767b78e572ae22d8649e0b

  1. Clone:

git clone https://github.com/termux/termux-packages.git

  1. Switch to commit

git checkout 619095bbd0307851a7767b78e572ae22d8649e0b

  1. Install dependencies

pkg i freetype game-music-emu libaom libandroid-glob libass libbluray libbz2 libdav1d libgnutls libiconv liblzma libmp3lame libopus librav1e libsoxr libssh libtheora libvorbis libvpx libvidstab libwebp libx264 libx265 libxml2 libzimg littlecms ocl-icd xvidcore zlib opencl-headers jq

  1. Build

./build-package.sh ffmpeg -s


You may also find ha-av tries to want to build an older numpy==1.23.2 version than the one in the python-numpy package.

To do this, run CFLAGS=-Wno-implicit-function-declaration MATHLIB=m pip install numpy==1.23.2


You may also have problems with pynacl. To build:

pkg i libsodium

SODIUM_INSTALL=system pip install pynacl

3 Likes

same problem in my xiaomi note3 (linux deploy).

Why not build ffmpeg?

~/termux-packages $ ./build-package.sh ffmpeg -s
./build-package.sh: line 60: jq: command not found
ERROR: No package ffmpeg found in any of the enabled repositories. Are you trying to set up a custom repository?

You need to install jq:

pkg i jq

Or, here’s a compiled package of ffmpeg 5.1.2-7 for aarch64 that I have just built for Termux

Obviously, this is a binary provided by an internet stranger (me), so scan and use at your own risk

Use dpkg -i ffmpeg_5.1.2-7_aarch64.deb to install.

https://github.com/talss89/termux-ffmpeg-5/raw/main/ffmpeg_5.1.2-7_aarch64.deb

2 Likes

My aiodiscover/network.py was giving
FileNotFoundError: [Errno 2] No such file or directory: '/etc/resolv.conf'

If you are rooted (and don’t want to use termux-chroot), you can solve this error as follows: (thanks to askubuntu.com/a/175742)

Run
mount -v | grep "^/" | awk '{print "\nPartition identifier: " $1 "\n Mountpoint: " $3}'
and look for the mountpoint / (on my device it’s the first printed). You need the partition identifier for this mountpoint. In my case it was /dev/block/platform/soc/624000.ufshc/by-name/system

Then you can run:

sudo mount -o remount,rw THE_PARTITION_IDENTIFIER /
sudo cp /data/data/com.termux/files/usr/etc/resolv.conf /etc/resolv.conf
sudo mount --bind /data/data/com.termux/files/usr/etc/resolv.conf /etc/resolv.conf

Now resolv.conf exists in the /etc folder.

1 Like

Thanks, it’s work on HA 2023.5.1!

1 Like

Susesfully installed 2023.5.4 on Android 7 Huawey tablet using main, jambalaya posts and
pip install git+https://github.com/gilcu2/aiodiscover.git for /etc/resolv.conf problem when no root

Like that ```
aiohttp-3.8.1 step doesn’t needed any more because homeassistant install remove it and install 3.8.4

  1. Has any of you mitgated this?
[homeassistant] Error doing job: Exception in callback BaseSelectorEventLoop._accept_connection(<aiohttp.web_... 

In my case, it spits out upto 700 such events per second… Must be somekind of a loop.

It happens when internet connection is changed to other interface - f.e. WiFi to Ethernet in my case (I have a USB hub with ethernet port hooked up).

After disconnecting ethernet and restarting HASS, it worked fine for hours.
The moment I plugged in the Ethernet cable, the loop started.

  1. Has anyone tried the chrootted HASS?
    My device is rooted and maybe just switching to the chrooted install will solve most issues?

Hello, thanks for this guide! I’ve managed to apparently succesfully install this on two separate android devices, different phones, on different android versions, but with both, once I actually run home assistant, I seem to be forever stuck in ‘home assistant is starting, please wait…’, even though I left one such device running overnight, seeing if that would magically help. There doesn’t seem to be any errors showing up in termux either, to try and point me in any direction.

Did anyone encounter this too? Any idea what I could try?

Thanks!

you can install htop and navigate with arrows (right and down)
it’s enough to see what HA is trying to install

This is great!

It’s been over a year since you posted this, how’s life been using it over that time?

This widens the available off the shelf hardware enormously and tablets have internal batteries so will cope with power cuts up to a point. Many Zigbee sensors will run on the internal battery for a few hours too. As well as run of the mill tablets, there are loads of low cost wall mounted and table top Android tablets for smart home use out there.