Home Assistant Core on Android Tablet

I use wi-fi connection. Unfortunately I do not have a ethernet on the go adapter and I am not sure if it works.

If works, the problem would be charging the device while using OTG because then, the mobile phone set as charging device and usb host.

Pity that the WiFi module do not work…

Hi all,

I have been using for a while a 5G Nokia phone as a modem and since it’s basically it’s only function, I decided to install homeassistant on it (I don’t have anymore my pi3B).

I tried following the instructions here, tried many things actually, but i’m always stuck on cryptography and orjson.

My mobile uses an aarch64 platform. The full details about versions are:

Python: 3.10.7
platform: Linux-4.19.125-perf±aarch64-with-libc
pip: n/a
setuptools: 65.3.0
setuptools_rust: 1.5.2
rustc: 1.63.0

My latest problem with orjson is the code below. I’ve tried to run it running before export CARGO_BUILD_TARGET="$(rustc -Vv | grep “host” | awk ‘{print $2}’)" but it made no diference.

I have attached the error for cryptography here, since is too big to fit on this post.

Any ideas on what else could I try?

~ $ pip install orjson
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Collecting orjson
  Using cached orjson-3.8.0.tar.gz (949 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: orjson
  Building wheel for orjson (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for orjson (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [44 lines of output]
      Running `maturin pep517 build-wheel -i /data/data/com.termux/files/usr/bin/python --compatibility off`
         Compiling target-lexicon v0.12.4
         Compiling autocfg v1.1.0
         Compiling serde v1.0.144
         Compiling once_cell v1.13.1
         Compiling version_check v0.9.4
         Compiling rustversion v1.0.9
         Compiling libc v0.2.132
         Compiling ryu v1.0.11
         Compiling cfg-if v1.0.0
         Compiling itoa v1.0.3
         Compiling encoding_rs v0.8.31
         Compiling cc v1.0.73
         Compiling serde_json v1.0.85 (/data/data/com.termux/files/usr/tmp/pip-install-wvn6vp_r/orjson_9fff109b17ae4ad790eb0044f422b60f/local_dependencies/serde_json)
         Compiling associative-cache v1.0.1
         Compiling simdutf8 v0.1.4
         Compiling smallvec v1.9.0
         Compiling bytecount v0.6.3
         Compiling ahash v0.8.0
         Compiling num-traits v0.2.15
         Compiling num-integer v0.1.45
         Compiling pyo3-build-config v0.17.0
         Compiling castaway v0.2.2
         Compiling chrono v0.4.19
         Compiling pyo3-ffi v0.17.0
         Compiling orjson v3.8.0 (/data/data/com.termux/files/usr/tmp/pip-install-wvn6vp_r/orjson_9fff109b17ae4ad790eb0044f422b60f)
         Compiling arrayvec v0.7.2
         Compiling compact_str v0.6.1
         Compiling beef v0.5.2
      error: could not compile `orjson` due to 2 previous errors
      💥 maturin failed
        Caused by: Failed to build a native library through cargo
        Caused by: Cargo build finished with "exit status: 101": `"cargo" "rustc" "--release" "--target" "aarch64-linux-android" "--message-format" "json" "--lib"`
      📦 Including license file "LICENSE-APACHE"
      📦 Including license file "LICENSE-MIT"
      🔗 Found pyo3-ffi bindings
      🐍 Found CPython 3.10 at /data/data/com.termux/files/usr/bin/python
      error: failed to prepare thin LTO module: Opaque pointers are only supported in -opaque-pointers mode (Producer: 'LLVM15.0.1' Reader: 'LLVM 15.0.1')
      
      
      error: aborting due to previous error
      
      
      Error: command ['maturin', 'pep517', 'build-wheel', '-i', '/data/data/com.termux/files/usr/bin/python', '--compatibility', 'off'] returned non-zero exit status 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for orjson
Failed to build orjson
ERROR: Could not build wheels for orjson, which is required to install pyproject.toml-based projects

All I can say is that this seems to be the cause, it’s found on both logs. Never had that before, though.

I see that it’s using LLVM/clang version 15, which seems to be a recent upgrade in Termux from this week. Mine is still using version 14. I see there were several issues of compatibility with this upgrade, some packages not up to date, some libraries not updated to match, etc.
So I’d say you’re unlucky and fell exactly in the wrong time.

That said, your error doesn’t seem related to Termux per se, more to the new LLVM version. Maybe we need to find a way to activate those opaque-pointers?

Maybe if i had the v14 files, I could donwgrade it…

I mean it’s embedded in the Termux package, and will most likely be this way for the future, so I’m not sure if it’s the way to go, rather to work around that or fix it.

If I could find it, could be quicker than looking for a way but I couldn’t find the Deb files.

About fixing, googled it around but couldn’t find a way yet

Ok. So, I managed to install it. What I did was:

orjson

pip download orjson==3.7.11

tar xvf orjson-3.7.11.tar.gz

cd orjson-3.7.11

nano Cargo.toml

commented out lto = "thin"

maturin build --release --strip

cd ..

rm orjson-3.7.11.tar.gz

tar -czvf orjson-3.7.11.tar.gz orjson-3.7.11

cryptography

pip download cryptography==37.0.4

tar xvf cryptography-37.0.4.tar.gz

cd cryptography-37.0.4/src/rust

nano Cargo.toml

commented out lto = "thin"

maturin build --release --strip

cd

cd ../../../

rm cryptography-37.0.4.tar.gz

tar -czvf cryptography-37.0.4.tar.gz cryptography-37.0.4

then i followed with installation steps, but manually installing orjson and cryptography:

python -m venv hass

source hass/bin/activate

pip install orjson-3.7.11.tar.gz

pip install cryptography-37.0.4.tar.gz

pip install homeassistant
2 Likes

Thank you for the guide and support! Comments from @Gnoupi and @leofuscaldi were very useful!

Managed to install it on an Asus ZenPad Z500M running Android 7. Did not have to install lineage OS. Also installed it in parallel on a OnePlus 7 Pro with LineageOS 18.1

Managed to connect multiple devices, works pretty well. I still have these issues in the log, if someone fixed these already, please share :slight_smile:

Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: hardware')
October 2, 2022 at 11:29:43 PM – (ERROR) setup.py
Unable to set up dependencies of default_config. Setup failed for dependencies: hardware
October 2, 2022 at 11:29:43 PM – (ERROR) setup.py
Error during setup of component hardware
October 2, 2022 at 11:29:41 PM – (ERROR) components/hardware/websocket_api.py

The hardware error can be fixed by using this commit to psutils fix #2138 (critical): re-define ethtool_cmd_speed · giampaolo/psutil@b88f4d8 · GitHub

I had trouble using pip download so I used unearth to get the url link and downloaded it with wget.

python -m pip install --upgrade unearth
unearth psutil | grep url
wget https://files.pythonhosted.org/packages/8f/57/828ac1f70badc691a716e77bfae258ef5db76bb7830109bf4bcf882de020/psutil-5.9.2.tar.gz
tar xvf psutil-5.9.2.tar.gz

change 2 files like in the commit and then:

rm psutil-5.9.2.tar.gz
tar -czvf psutil-5.9.2.tar.gz psutil-5.9.2
pip install psutil-5.9.2.tar.gz
3 Likes

Hey, I’m rather new to Linux in general, so please bear with me. I was having issues installing any packages that needed to generate a wheel, and came across this forum. I was trying to install cryptography through termux. I’ve never used home assistant, so my use case may differ here. I did a little research and found I could set an environment variable to force rustc to not use the lto flag, something like

export RUSTFLAGS="-C lto=n"

If this is a dumb way to do this, please let me know, but I was finally able to install what I needed after setting the variable.

3 Likes

I don’t think its dumb, its easier and faster than changing the files.

Hey everyone,

Having trouble at the orjson point:

Collecting orjson==3.7.11
  Using cached orjson-3.7.11.tar.gz (946 kB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [58 lines of output]
      Collecting maturin<0.14,>=0.13
        Using cached maturin-0.13.5.tar.gz (150 kB)
        Installing build dependencies: started
        Installing build dependencies: finished with status 'done'
        Getting requirements to build wheel: started
        Getting requirements to build wheel: finished with status 'done'
        Preparing metadata (pyproject.toml): started
        Preparing metadata (pyproject.toml): finished with status 'done'
      Collecting tomli>=1.1.0
        Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
      Building wheels for collected packages: maturin
        Building wheel for maturin (pyproject.toml): started
        Building wheel for maturin (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
× Building wheel for maturin (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [34 lines of output]
            running bdist_wheel
            running build
            running build_py
            creating build
            creating build/lib.linux-aarch64-cpython-310
            creating build/lib.linux-aarch64-cpython-310/maturin
            copying maturin/__main__.py -> build/lib.linux-aarch64-cpython-310/maturin
            copying maturin/__init__.py -> build/lib.linux-aarch64-cpython-310/maturin
            copying maturin/import_hook.py -> build/lib.linux-aarch64-cpython-310/maturin
            running egg_info
            creating maturin.egg-info
            writing maturin.egg-info/PKG-INFO
            writing dependency_links to maturin.egg-info/dependency_links.txt
            writing requirements to maturin.egg-info/requires.txt
            writing top-level names to maturin.egg-info/top_level.txt
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest file 'maturin.egg-info/SOURCES.txt'
            reading manifest template 'MANIFEST.in'
            writing manifest file 'maturin.egg-info/SOURCES.txt'
            running build_ext
            running build_rust
            error: rustup could not choose a version of rustc to run, because one wasn't specified explicitly, and no default is configured.

Have already installed the Rust and Cargo packages, so I’m at a loss here.

Did you install rustup? I had that issue too on termux (sandboxed Linux app for Android), rustup doesn’t support termux based builds. I think I’d installed rust with my package manager, and then installed rustup on top of it (not good lol). Try doing rustup self uninstall and then install rust (if you haven’t already) through your normal package manager, then try again.

1 Like

Hello

So I managed to successfully install the recent version of HA on my Android11 tablet, without any errors.
However running the HA with hass -v gives me the following errors
Running HA in safe mode works fine.

Can someone please guide? Thanks in advance.



2022-10-10 21:30:19.962 ERROR (MainThread) [homeassistant.setup] [u]**[u]**Error during setup of component hardware**[/u]**[/u]
Traceback (most recent call last):
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/homeassistant/setup.py", line 235, in _async_setup_component
    result = await task
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/homeassistant/components/hardware/__init__.py", line 15, in async_setup
    await websocket_api.async_setup(hass)
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/homeassistant/components/hardware/websocket_api.py", line 36, in async_setup
    ha_psutil=await hass.async_add_executor_job(ha_psutil.PsutilWrapper),
  File "/data/data/com.termux/files/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/psutil_home_assistant/__init__.py", line 15, in __init__
    psutil_spec.loader.exec_module(psutil_module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/psutil/__init__.py", line 42, in <module>
    from . import _common
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/psutil/__init__.py", line 102, in <module>
    from . import _pslinux as _psplatform
  File "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/psutil/_pslinux.py", line 26, in <module>
    from . import _psutil_linux as cext
ImportError: dlopen failed: cannot locate symbol "ethtool_cmd_speed" referenced by "/data/data/com.termux/files/home/hass/lib/python3.10/site-packages/psutil/_psutil_linux.cpython-310.so"...
2022-10-10 21:30:19.986 INFO (MainThread) [homeassistant.setup] Setup of domain zone took 0.5 seconds
2022-10-10 21:30:19.994 INFO (MainThread) [homeassistant.setup] Setup of domain schedule took 0.5 seconds
2022-10-10 21:30:19.997 INFO (MainThread) [homeassistant.setup] Setup of domain input_text took 0.5 seconds
2022-10-10 21:30:20.027 INFO (MainThread) [homeassistant.setup] Setting up tts
2022-10-10 21:30:20.030 INFO (MainThread) [homeassistant.setup] Setting up sensor
2022-10-10 21:30:20.032 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 0.0 seconds
2022-10-10 21:30:20.050 INFO (MainThread) [homeassistant.setup] Setup of domain input_select took 0.5 seconds
2022-10-10 21:30:20.063 INFO (MainThread) [homeassistant.setup] Setup of domain input_boolean took 0.5 seconds
2022-10-10 21:30:20.065 INFO (MainThread) [homeassistant.setup] Setup of domain input_button took 0.5 seconds
2022-10-10 21:30:20.082 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.energy
2022-10-10 21:30:20.086 INFO (SyncWorker_2) [homeassistant.loader] Loaded notify from homeassistant.components.notify
2022-10-10 21:30:20.194 INFO (MainThread) [homeassistant.setup] Setting up mobile_app
2022-10-10 21:30:20.198 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.2 seconds
2022-10-10 21:30:20.202 INFO (MainThread) [homeassistant.setup] Setup of domain mobile_app took 0.0 seconds
2022-10-10 21:30:20.206 INFO (MainThread) [homeassistant.setup] Setting up notify
2022-10-10 21:30:20.207 INFO (MainThread) [homeassistant.setup] Setup of domain notify took 0.0 seconds
2022-10-10 21:30:20.214 ERROR (MainThread) [homeassistant.setup] Unable to set up dependencies of default_config. Setup failed for dependencies: hardware
[u]**2022-10-10 21:30:20.225 ERROR (MainThread) [homeassistant.setup] Setup failed for default_config: (DependencyError(...), 'Could not setup dependencies: hardware')**[/u]
2022-10-10 21:30:20.233 INFO (MainThread) [homeassistant.components.notify] Setting up notify.mobile_app
2022-10-10 21:30:40.029 ERROR (MainThread) [metno] Access to https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete returned error 'ClientConnectorError'
2022-10-10 21:30:40.040 WARNING (MainThread) [homeassistant.config_entries] Config entry 'Home' for met integration not ready yet: Update failed: ; Retrying in background
2022-10-10 21:30:40.050 INFO (MainThread) [homeassistant.bootstrap] Home Assistant initialized in 26.50s
2022-10-10 21:30:40.052 INFO (MainThread) [homeassistant.core] Starting Home Assistant
2022-10-10 21:30:40.082 INFO (MainThread) [homeassistant.components.zeroconf] Starting Zeroconf broadcast
CRITICAL: Can't open /proc/net/dev !
2022-10-10 21:30:41.977 CRITICAL (SyncWorker_0) [scapy.loading] Can't open /proc/net/dev !
CRITICAL: Can't open /proc/net/route !
2022-10-10 21:30:41.998 CRITICAL (SyncWorker_0) [scapy.loading] Can't open /proc/net/route !
CRITICAL: Can't open /proc/net/dev !
2022-10-10 21:30:42.006 CRITICAL (SyncWorker_0) [scapy.loading] Can't open /proc/net/dev !
2022-10-10 21:30:42.291 WARNING (SyncWorker_1) [pyroute2.netlink.rtnl.tcmsg.common] tcmsg: [Errno 13] Permission denied: '/proc/net/psched'
2022-10-10 21:30:42.307 WARNING (SyncWorker_1) [pyroute2.netlink.rtnl.tcmsg.common] the tc subsystem functionality is limited
2022-10-10 21:30:50.614 ERROR (MainThread) [homeassistant.components.homeassistant_alerts] Timeout fetching homeassistant_alerts data
2022-10-10 21:31:00.102 ERROR (MainThread) [metno] Access to https://aa015h6buqvih86i1.api.met.no/weatherapi/locationforecast/2.0/complete returned error 'ClientConnectorError'
^C2022-10-10 21:31:01.188 INFO (Recorder) [homeassistant.components.recorder.pool.RecorderPool] Pool recreatingte code here

In same point of install, stop with some errors:
Failed to find tool
Cargo build…
Failed building wheel for maturin…

… a very long log.
any tip?

Looks like the same error as in this message: Home Assistant Core on Android Tablet - #134 by snotfod

“A very long log” unfortunately does not help much when it comes to finding a solution. Unless you know what to find in the log and can provide it in your post, you’d have to post all the relevant log.

That said, @leofuscaldi reported issues in the cargo build and maturin failing, check if it’s the same error: Home Assistant Core on Android Tablet - #127 by leofuscaldi
He managed to work around it by doing a lot of things manually: Home Assistant Core on Android Tablet - #132 by leofuscaldi

With that in mind, this answer seem to suggest and easier way to deal with the issue, maybe you could try that: Home Assistant Core on Android Tablet - #135 by BeagleGreen

Hello,
i just created my account to be able to reply to this.
I highly recommend looking into the app Linux Deploy
I started with the suggested approach here but I struggled a lot with fixing all the compilation errors and it was very slow on my Samsung Galaxy S5. Also I forogt the wake lock and all the time my mobile CPU went to sleep. But in the end it was running. But other issues with the bluetooth and so on made me crazy so I started this evening with Linux Deploy and the Homeassistant Server is already running.
Long story short : Linux Deploy is worth a try.

I’m trying to install Home Assistant on a Samsung S2 tablet running LineageOs.
I’m following the instructions from Home Assistant Core on Android Tablet - #64 by deividAlfa excepted for Python version where I have followed the instructions from Home Assistant Core on Android Tablet - #96 by Gnoupi to run it on the latest version (I have 3.11). I’m getting some errors during “pip install wheel homeassistant” (see below). Would you know what could be wrong? The log is long so I have only copied the errors below.
Thank you


/////////////
creating build/temp.linux-armv7l-cpython-311/aiohttp 
arm-linux-androideabi-clang -mfloat-abi=softfp -mfpu=vfpv3-d16 -DNDEBUG -g -fwrapv -O3 -Wall -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fstack-protector-strong -O3 -march=armv7-a -mfpu=neon -mfloat-abi=softfp -mthumb -fstack-protector-strong -O3 -fPIC -I/data/data/com.termux/files/home/hass/include -I/data/data/com.termux/files/usr/include/python3.11 -c aiohttp/_websocket.c -o build/temp.linux-armv7l-cpython-311/aiohttp/_websocket.o
aiohttp/_websocket.c:198:12: fatal error: 'longintrepr.h' file not found       #include "longintrepr.h"
 ^~~~~~~~~~~~~~~              1 error generated. 
error: command '/data/data/com.termux/files/usr/bin/arm-linux-androideabi-clang' failed with exit code 1                                                                                                                [end of output]                                                                                                                                                                                                     note: This error originates from a subprocess, and is likely not a problem with pip.                        
ERROR: Failed building wheel for aiohttp     

/////////////
Compiling arrayvec v0.7.2                                                                               
error: could not compile `orjson` due to 2 previous errors  
💥 maturin failed 
Caused by: Failed to build a native library through cargo    
    
/////////////
  ERROR: Failed building wheel for cryptography    

/////////////
  ERROR: Failed building wheel for orjson     
             
/////////////
Failed to build aiohttp cryptography orjson
ERROR: Could not build wheels for aiohttp, cryptography, orjson, which is required to install pyproject.toml-based projects

For aiohttp, would be good to check which version is required. Looks like there are some issues with python 3.11 (note that I still have 3.10) which should be fixed, though only recently: https://github.com/aio-libs/aiohttp/issues/6600 So we might just have a requirement which is not up to date in HA.

Or you could try downgrading python to 3.10 for the time being, I suppose.

For the rest, it’s hard to say as the errors are missing the context and actual causes. For cryptography and orjson, there are several messages earlier about potential solutions. I haven’t tried them yet as I’m still running a 2022.8, so I can’t tell much more about them.