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

Thank you it is working now

when i try to run hass the following error appears:

(homeassistant) ~/.homeassistant $ pm2 logs hass
[TAILING] Tailing last 15 lines for [hass] process (change the value with --lines option)
/data/data/com.termux/files/home/.pm2/logs/hass-out.log last 15 lines:
2|hass     | Unable to find configuration. Creating default one in /data/data/com.termux/files/home/.homeassistant

/data/data/com.termux/files/home/.pm2/logs/hass-error.log last 15 lines:
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/ssdp/__init__.py", line 51, in _async_initialize
2|hass     |     await scanner.async_scan(None)
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/ssdp/__init__.py", line 91, in async_scan
2|hass     |     await self._process_entries()
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/ssdp/__init__.py", line 138, in _process_entries
2|hass     |     await asyncio.gather(*tasks)
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 150, in async_init
2|hass     |     flow, result = await task
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 176, in _async_init
2|hass     |     result = await self._async_handle_step(flow, flow.init_step, data, init_done)
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 257, in _async_handle_step
2|hass     |     result: FlowResult = await getattr(flow, method)(user_input)
2|hass     |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/fritz/config_flow.py", line 115, in async_step_ssdp
2|hass     |     "name": self._name.replace("FRITZ!Box ", "")
2|hass     | AttributeError: 'NoneType' object has no attribute 'replace'

ok after doing some changes these are the only 3 errors I get while running hass. Can someone help me?

1|hass  | 2021-05-10 22:03:23 WARNING (Recorder) [homeassistant.components.recorder.util] The system could not validate that the sqlite3 database at //data/data/com.termux/files/home/.homeassistant/home-assistant_v2.db was shutdown cleanly
1|hass  | 2021-05-10 22:03:23 WARNING (Recorder) [homeassistant.components.recorder.util] Ended unfinished session (id=2 from 2021-05-10 19:58:59.400018)
1|hass  | 2021-05-10 22:04:40 WARNING (MainThread) [homeassistant.bootstrap] Waiting on integrations to complete setup: http, input_datetime, timer, input_number, system_health, scene, scene.homeassistant, media_source, counter, zone, tag, input_select, input_text, input_boolean, group, logbook

after deleting home-assistant_v2.db I get following error messages:

1|hass  | 2021-05-10 22:40:03 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
1|hass  | Traceback (most recent call last):
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/ssdp/__init__.py", line 51, in _async_initialize
1|hass  |     await scanner.async_scan(None)
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/ssdp/__init__.py", line 91, in async_scan
1|hass  |     await self._process_entries()
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/ssdp/__init__.py", line 138, in _process_entries
1|hass  |     await asyncio.gather(*tasks)
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 150, in async_init
1|hass  |     flow, result = await task
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 176, in _async_init
1|hass  |     result = await self._async_handle_step(flow, flow.init_step, data, init_done)
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 257, in _async_handle_step
1|hass  |     result: FlowResult = await getattr(flow, method)(user_input)
1|hass  |   File "/data/data/com.termux/files/home/homeassistant/lib/python3.9/site-packages/homeassistant/components/fritz/config_flow.py", line 115, in async_step_ssdp
1|hass  |     "name": self._name.replace("FRITZ!Box ", "")
1|hass  | AttributeError: 'NoneType' object has no attribute 'replace'

Hi, some idea how to solve it? Thanks!

Sorry but i can’t help you. My phone is now on android 10 version and it’s not rooted. And google is locking down android with every new version. Now i can’t install hass on termux :frowning: I’m afraid homeassistant install in termux will become impossible eventually.

Hmmm :confused:
It seems incredible to me that this is practically the only post (and therefore you the only good person) to do a tutorial on this.
Everyone takes for granted using a Rasberry Pi, while an old android could cost even less, be more beautiful (aesthetically) and functional. Sin!
Thanks anyway for trying!

I installed HomeAsisstant based on this tutorial and everything worked! (GitHub - alexanderhale/home-assistant: Home Assistant setup on a Nexus 7 tablet.). I use Android 9 on my phone tho so I’m not sure if it works for android 10 as well.

I have and old Samsung S2 with 5.1 Os. I gonna try, thanks!

If you have any problems regarding resolv.conf don’t forget to install:

pkg install resolv-conf
1 Like

@vladosam
could you please check on your backup installation on Android if upgrading to 2021.5.x brings errors with dhcp and zeroconf? I know about one more user having it too, everything else is working fine.
edit: only now I see you couldn´t install hass on Termux anymore, nevermind, time to move on, thanks, it´s been a ride!

1 Like

You can still run it on android versons < 10. But eventually it will hit the wall. It’s a shame i always had termux as a backup if something happens to my main machine.

Just out of interest, what main machine do you use? And which from several oficially supported options would you recommend as most future-proof in your opinion?

I used rpi 2-3 and now i’m on libre computer le potato board. My setup is small an without cameras, so i don’t need to much power. A couple of my friends runs everything on unraid machines. And they say it works great for them. So in the future i will probably go in that direction.

1 Like

Let me add an example here which might be contradicting. I have HA on my android and installed OTG adapter and plugged in CC2531 and i am redirecting USB to serial port and use ZHA to access Zigbee dongle and everything seems to be working.

While you are right about using old phone, pi is a standardized solution but android is full of tricks/hacks. Yes, it is working as of today but I am dead scared in every update what will be broken.

Another post which was useful to me: Home Assistant Core on Android Tablet

Yes it seems if phone is rooted it can work with cc2531. But again, i’m afraid there is no future with termux. How to use on Android ( TV Boxes, phones via USB-OTG ) · Issue #1861 · Koenkk/zigbee2mqtt · GitHub

why do you think there is no future here? ZHA is working over TCP connection and I am using a python script to mirror serial port into TCP, all seems to be working. Actually, it is working better than Sonoff Zigbee Bridge in my experience :slight_smile:

on another topic, after I ugrade to home assistant 2021.6.3, i had issues with timezone, I fixed it via updating tzdata

  • pip install tzdata

I was having regular resolve.conf error in my logs as there was no file in /etc/resolve.conf. I had to mount system partition as root user and copy termux’s resolve.conf into etc, so it is silent now :slight_smile:

1 Like

This is from termux github.
We do not want to introduce the breaking changes to comply with Google's requirements. But as result Termux does not support Android 10 officially.*
And every next version of android will be even more restricted.

I see, so if we want to move forward with new android versions, we will lose termux support. I will try to hang around with my samsung a7 without updating and see how further i can reach :slight_smile: thanks for great guide again

1 Like