Install Home Assistant, Mosquitto broker and Node-Red on android

Do you have Keep wi-fi on during sleep option enabled?

Hi
Wifi on during sleep is set to always in the android advanced settings

Than only solution is some app but you already done that. Or android box with ethernet.

1 Like

You could try to use ping sensor in HA and ping your router. Maybe phone won’t shutdown wifi if there is some trafic. It’s long shot but you can try it.

binary_sensor:
  - platform: ping
    host: 192.168.1.1
    count: 2
    scan_interval: 30

Sorry about the delay in replying. After investigation, I suspect my network was causing thr problem. In typical nooby fashion, I twiddled about with parameters I have no idea what they do and it seems to be working ok now…

Hey vladosam, thanks for your help, my HA instance is running fine on my android TV box. Now I’m trying to make ssl work, loosely following this guide:

But whenever I get to step 4 => getting the SSL certificate with this (email and URL is changed of course…):

$ ./certbot-auto certonly --standalone --preferred-challenges http-01 --email [email protected] -d examplehome.duckdns.org

I receive the following error and no letsencrypt dir is created:

bash: ./certbot-auto no such file or directory

Certbot-auto is there and its permissions are correct. I tried a lots of things to fix it, but came to a full stop.

Any pointers?

I just tried to run certbot-auto and it starts ok. Are you in the right folder when run certobot-auto from tutorial it should be certobot. Type pwd in termux to see where you are.

I’m in
/data/data/com.termux/files/home/certbot

I realy don’t know why you can’t run this. Type bash then cert and press tab to auto fill. Don’t add any more arguments.

Now it says:

“sudo” is not available, will use “su” for installation steps…
Requesting to rerun certbot-auto with root privileges…
tmp-mksh: certbot-auto: not found

(“tmp-mksh” used to be “bash”, but I tried some su commands, but first it was “bash”)

My phone is not rooted so i can’t help you with this. Termux is not average linux disto i’m not shure you can do this in termux. Try with google.

Having this same issue (brand new user). How would one install venv with an old python version? Does this fix the issue?

What is your python version? If you installed homeassistant in python3.6 and than upgraded to 3.7, uninstall and then install it again.

Just trying to do a first-time install so I get 3.7 why I pkg install python

Then just install homeassistant in venv. https://www.home-assistant.io/docs/installation/virtualenv/

Ok, I’ll give this a shot. This is known to fix discovery issue ( AttributeError: undefined symbol: getifaddrs)?

Just try. I never saw that issue.

Hmm, still getting the issue. Made a totally clean termux and followed instructions to the letter. Getting the same behavior in the virtualenv:

i`2019-01-14 16:50:59 INFO (MainThread) [homeassistant.core] Starting Home Assistant

2019-01-14 16:50:59 INFO (MainThread) [homeassistant.core] Timer:starting
2019-01-14 16:51:00 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/homeassistant/components/discovery.py”, line 178, in scan_devices
results = await hass.async_add_job(_discover, netdisco)
File “/data/data/com.termux/files/usr/lib/python3.7/concurrent/futures/thread.py”, line 57, in run
result = self.fn(*self.args, **self.kwargs)
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/homeassistant/components/discovery.py”, line 206, in _discover
netdisco.scan()
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/netdisco/discovery.py”, line 57, in scan
self.mdns.start()
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/netdisco/mdns.py”, line 23, in start
self.zeroconf = zeroconf.Zeroconf()
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/zeroconf.py”, line 1724, in init
interfaces = normalize_interface_choice(interfaces)
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/zeroconf.py”, line 1655, in normalize_interface_choice
return get_all_addresses()
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/zeroconf.py”, line 1645, in get_all_addresses
for iface in ifaddr.get_adapters()
File “/data/data/com.termux/files/home/homeassistant/lib/python3.7/site-packages/ifaddr/_posix.py”, line 44, in get_adapters
retval = libc.getifaddrs(ctypes.byref(addr))
File “/data/data/com.termux/files/usr/lib/python3.7/ctypes/init.py”, line 369, in getattr
func = self.getitem(name)
File “/data/data/com.termux/files/usr/lib/python3.7/ctypes/init.py”, line 374, in getitem
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: undefined symbol: getifaddrs
`

I just upgrade all termux packages to latest and also hass to 0.85.1. And no AttributeError: undefined symbol: getifaddrs error. What is your pip version in venv? Upgrade it to latest. Activate venv and run

pip install --upgrade pip

Then restart hass. Also run pkg list-installed to see what packages are installed on your system.

Thanks a ton for your help. I removed Termux data and started over from scratch. The problem persists. Here is exactly what I did starting with fresh Termux:

----------- From Phone (Installed Termux and Termux:API) -----------
pkg update
pkg upgrade
termux-setup-storage
pkg install open ssh
ssh-keygen
cd $HOME/.ssh
cat id_rsa.pub >> authorized_keys
chmod 700 $HOME/.ssh/*
cp id_rsa /sdcard
sshd

----------- From SSH -----------
pkg install python python-dev coreutils nano ndk-stl clang mosquitto nodejs termux-api libffi-dev openssl-dev
python -m venv homeassistant
cd homeassitant
source bin/activate
pip install --upgrade pip
python -m pip install wheel
python -m pip install homeassistant
hass

----------- pkg list-installed -----------
Listing… Done
apt/stable,now 1.4.8-8 aarch64 [installed]
bash/stable,now 4.4.23-3 aarch64 [installed]
binutils/stable,now 2.31.1-3 aarch64 [installed,automatic]
busybox/stable,now 1.29.3-1 aarch64 [installed]
c-ares/stable,now 1.15.0 aarch64 [installed,automatic]
ca-certificates/stable,now 20181205 all [installed]
clang/stable,now 7.0.1 aarch64 [installed]
command-not-found/stable,now 1.36 aarch64 [installed]
coreutils/stable,now 8.30-1 aarch64 [installed]
dash/stable,now 0.5.10.2-1 aarch64 [installed]
dpkg/stable,now 1.19.2 aarch64 [installed]
gdbm/stable,now 1.18.1 aarch64 [installed,automatic]
gpgv/stable,now 2.2.12 aarch64 [installed]
krb5/stable,now 1.16.2 aarch64 [installed,automatic]
ldns/stable,now 1.7.0-5 aarch64 [installed,automatic]
libandroid-glob/stable,now 0.4 aarch64 [installed,automatic]
libandroid-support/stable,now 22 aarch64 [installed]
libandroid-support-dev/stable,now 22 aarch64 [installed,automatic]
libbz2/stable,now 1.0.6-1 aarch64 [installed]
libc++/stable,now 18 aarch64 [installed]
libcrypt/stable,now 0.2-1 aarch64 [installed,automatic]
libcrypt-dev/stable,now 0.2-1 aarch64 [installed,automatic]
libcurl/stable,now 7.63.0 aarch64 [installed]
libdb/stable,now 6.2.32 aarch64 [installed,automatic]
libedit/stable,now 20181209-3.1-0 aarch64 [installed,automatic]
libffi/stable,now 3.2.1-2 aarch64 [installed,automatic]
libffi-dev/stable,now 3.2.1-2 aarch64 [installed]
libgcrypt/stable,now 1.8.4 aarch64 [installed]
libgpg-error/stable,now 1.33 aarch64 [installed]
libicu/stable,now 63.1 aarch64 [installed,automatic]
libllvm/stable,now 7.0.1 aarch64 [installed,automatic]
liblzma/stable,now 5.2.4 aarch64 [installed]
libmosquitto/stable,now 1.5.5 aarch64 [installed,automatic]
libnghttp2/stable,now 1.35.1 aarch64 [installed]
libsqlite/stable,now 3.25.3 aarch64 [installed,automatic]
libutil/stable,now 0.3 aarch64 [installed,automatic]
libuuid/stable,now 1.0.3-2 aarch64 [installed,automatic]
mosquitto/stable,now 1.5.5 aarch64 [installed]
nano/stable,now 3.2 aarch64 [installed]
ncurses/stable,now 6.1.20181117 aarch64 [installed]
ncurses-ui-libs/stable,now 6.1.20181117 aarch64 [installed,automatic]
ndk-stl/stable,now 18-4 aarch64 [installed]
ndk-sysroot/stable,now 18-8 aarch64 [installed,automatic]
nodejs/stable,now 11.6.0 aarch64 [installed]
openssh/stable,now 7.9p1-2 aarch64 [installed]
openssl/stable,now 1.1.1a aarch64 [installed]
openssl-dev/stable,now 1.1.1a aarch64 [installed]
python/stable,now 3.7.2 aarch64 [installed]
python-dev/stable,now 3.7.2 aarch64 [installed]
readline/stable,now 7.0.5-1 aarch64 [installed]
termux-am/stable,now 0.2 all [installed]
termux-api/stable,now 0.38 aarch64 [installed]
termux-auth/stable,now 1.1 aarch64 [installed,automatic]
termux-exec/stable,now 0.3 aarch64 [installed]
termux-tools/stable,now 0.59 all [installed]