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

Hm, i don’t know. You can try. But i use this as a backup for my RPi. If something happened to RPi i can turn on my old phone switch ip with RPi and i’m back in business. Now if i need to run it 24/7 on android i would rather use android tv box. Ethernet, no battery etc.

The battery backup is something that I like about using an old phone. I will probably run it as a backup solution for the first few months to monitor its reliability.

Yes phone battery as ups is nice. You can even use termux-api to send sms if battery is below something. Cheap power failure notification software. :slight_smile:

1 Like

Hi, would you have an updated guide. Sorry, I am new to this. I have Termux & Termux:API. But Node-Red gives errors… Please assist.

I can’t edit my first post. Try thIs:

pkg update
pkg install python python-dev coreutils nano ndk-stl clang mosquitto nodejs openssh termux-api make

npm i -g --unsafe-perm node-red

I’ve added make in pkg install. node-red is building something from source and that stopped it from installing.

1 Like

Hi @vladosam

Thank you very much for your guide. I just followed your guide to install HA on my Android 7.0. I’ve tried to install the Broadlink component but I could not make it work.

Can you take a look at the following question?

Thank you.

Try this:

pip install pyaes
pip show pycrypto
pip uninstall pycrypto
pip install --upgrade pycrypto

Thank you for a very nice guide. Excellent idea to use an old android phone. Have followed yr guide and even been able to upgrade HA to 0.65.1.

Now trying to use the IKEA Tradfri components but it fails to install with error msg:

Unable to install package pytradfri[async]==4.1.0: Command “/data/data/com.termux/files/usr/bin/python -u -c “import setuptools, tokenize;file=‘/data/data/com.termux/files/usr/tmp/pip-build-rdba6avw/DTLSSocket/’;f=getattr(tokenize, ‘open’, open)(file);‘\r\n’, ‘\n’);f.close();exec(compile(code, file, ‘exec’))” install --record /data/data/com.termux/files/usr/tmp/pip-w6ijtvvu-record/install-record.txt --single-version-externally-managed --prefix --compile --user --prefix=” failed with error code 1 in /data/data/com.termux/files/usr/tmp/pip-build-rdba6avw/DTLSSocket/

Being new into HA this is far above my capability. Read in this thread:

that a recompilation of python might help. but before going down this path I give it a try here in the hope that someone could offer an alternative solution for this env.

Many thanks

I don’t use IKEA Tradfri but i did try to install pytradfri on my phone and it installed successfully.

pkg install autoconf

activate python virtual env if you using it

source ~/homeassistant/bin/activate

pip3 install --upgrade pytradfri[async]==4.1.0

Now it was pretty slow installation more then 30 minutes on Moto G4. So if it seems like it’s stuck just leave it.

1 Like

Thanks a lot! Now tradfri is up and running!
For my understanding, is it the autoconf package that made the trick?
In any case, thanks a lot for your excellent support!

Nice, I’m glad I could help.
I believe so. There is a note about autoconf in IKEA tradfri components page.

Hi, I’m having problems with mqtt. HA says: the following components could not setup:

My configuration.yaml looks like this:


port: 1883
client_id: mqttha
keepalive: 60
username: !secret mqtt_username
password: !secret mqtt_password

Any help? Thanks in advance!

Did you configure mosquitto to use username and password?

Yes, with this:
mosquitto_passwd -c passwordfile user

I can acces the passwd file created.

And this is in mosquitto.conf?
password_file /path/to/mosquitto/passwd
allow_anonymous false

Yes, both lines with the correct path.

Then check indentation in configuration.yaml. This config works for me.

  broker: localhost
  port: 1883
  username: test
  password: test
  client_id: mqttha
  keepalive: 60
1 Like

The problem persist. Typing netstat -a I’m unable to see a localhost/1883 address. Could this be related?

Can you subscribe to mosquitto?

mosquitto_sub -h localhost -p 1883 -t topic -u test -P test

Txs for your efforts.
I can’t subscribe to mosquito.
Error: connection refused