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

Olá isso ainda funciona? Tentei seguir mas diz que o ndk-stl não existe mais. Tem algum tutorial mais atualizado? Da pra instalar o junto?

Hello does it still work? Try to follow the example of ndk-stl that no longer exists. Do you have any more updated tutorials? Can you install together?

Yes it still works and you can’t install ex on termux just homeassistant core.

Install required packages.

pkg install python libffi openssl coreutils clang ndk-sysroot build-essential python2 nodejs-lts

Setup storage


Install homeassistant in python venv:

python -m venv homeassistant 
source homeassistant/bin/activate 
pip install --upgrade pip
pip install --upgrade wheel
pip install homeassistant

Run it once with hass command and wait few minutes


Open browser and go to

Stop hass ctrl+c

Use pm2 to start hass on termux

npm i -g --unsafe-perm pm2

pm2 start /data/data/com.termux/files/home/homeassistant/bin/hass --interpreter=/data/data/com.termux/files/home/homeassistant/bin/python -- --config /data/data/com.termux/files/home/.homeassistant/

If everything is ok and you can access hass with browser save pm2

pm2 save 

Add pm2 resurrect to .bashrc

1 Like

Deu tudo certo! Estou muito feliz, muito mesmo! Não sei nem como agradecer.Mas me surgiu uma duvida, como eu faço pra instalar addons do hass? Tipo o ESP_HOME, dessa forma não é possível? Desculpa a ignorância é que estou começando a pouco tempo e ainda estou aprendendo.

Everything worked! I am very happy, very much! I don’t even know how to thank you. But I had a question, how do I install hass addons? Like ESP_HOME, that is not possible? Sorry for the ignorance is that I’m starting a little while ago and I’m still learning.

When you try to save something in the configuration file you get this error

0|hass | 2020-05-24 01:40:18 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall homeassistant.restart (c:bb8c830c4f58419797b11176c020490e)>
0|hass | Traceback (most recent call last):
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/”, line 1269, in catch_exceptions
0|hass | await coro_or_task
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/”, line 1288, in _execute_service
0|hass | await handler.func(service_call)
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/”, line 517, in admin_handler
0|hass | await result
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/components/homeassistant/”, line 106, in async_handle_core_service
0|hass | errors = await conf_util.async_check_ha_config_file(hass)
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/”, line 830, in async_check_ha_config_file
0|hass | res = await check_config.async_check_ha_config_file(hass)
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/helpers/”, line 86, in async_check_ha_config_file
0|hass | config = await hass.async_add_executor_job(load_yaml_config_file, config_path)
0|hass | File “/data/data/com.termux/files/usr/lib/python3.8/concurrent/futures/”, line 57, in run
0|hass | result = self.fn(*self.args, **self.kwargs)
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/”, line 318, in load_yaml_config_file
0|hass | conf_dict = load_yaml(config_path)
0|hass | File “/data/data/com.termux/files/home/homeassistant/lib/python3.8/site-packages/homeassistant/util/yaml/”, line 58, in load_yaml
0|hass | with open(fname, encoding=“utf-8”) as conf_file:
0|hass | PermissionError: [Errno 13] Permission denied: ‘/data/data/com.termux/files/home/.homeassistant/configuration.yaml’

You can’t install addons on termux, but you can install esphome with pip. Create new venv for esphome and install it just like you install HA.

python -m venv esphome
source esphome/bin/activate 
pip install --upgrade pip
pip install --upgrade wheel
pip install esphome

How did you edit configuration.yaml? From termux or with ssh? If you enter ls -all command inside .homeassistant folder is there same user and group owner for all files?

1 Like

I just copied and pasted the file of my old homeassist, entering the folder through ES Explorer … What is the correct way to do it?

Start fresh. Copy content of files not files. Did you check users and groups with ls -all command?


ls -all
total 52
drwx------ 12 u0_a211 u0_a211 4096 May 24 16:36 .
drwx------  4 u0_a211 u0_a211 4096 May 24 15:40 ..
-rw-------  1 u0_a211 u0_a211   14 May 24 16:29 .bashrc
drwx------  4 u0_a211 u0_a211 4096 May 24 16:25 .cache
drwx------  3 u0_a211 u0_a211 4096 May 24 16:23 .config
drwx------  6 u0_a211 u0_a211 4096 May 24 16:40 .homeassistant
drwx------  4 u0_a211 u0_a211 4096 May 24 16:34 .node-red
drwx------  4 u0_a211 u0_a211 4096 May 24 16:26 .npm
drwx------  5 u0_a211 u0_a211 4096 May 24 16:28 .pm2
drwx------  3 u0_a211 u0_a211 4096 May 24 16:36 config
drwx------  5 u0_a211 u0_a211 4096 May 24 16:29 esphome
drwx------  6 u0_a211 u0_a211 4096 May 24 16:03 homeassistant
drwx------  2 u0_a211 u0_a211 4096 May 24 15:43 storage


ls -all                                     
total 200                                               
drwx------  6 u0_a211 u0_a211   4096 May 24 17:00 .     
drwx------ 12 u0_a211 u0_a211   4096 May 24 16:36 ..    
-rw-------  1 u0_a211 u0_a211      7 May 24 15:49 .HA_VERSION
drwx------  2 u0_a211 u0_a211   4096 May 24 16:27 .clou
ddrwx------  2 u0_a211 u0_a211   4096 May 24 16:27 .storage
-rw-------  1 u0_a211 u0_a211      2 May 24 15:49 automations.yaml 
-rw-------  1 u0_a211 u0_a211    263 May 24 15:49 configuration.yaml 
drwx------  2 u0_a211 u0_a211   4096 May 24 15:49 deps  
-rw-------  1 u0_a211 u0_a211      0 May 24 15:49 groups.yaml  
-rw-------  1 u0_a211 u0_a211   2321 May 24 16:02 home-assistant.log
-rw-------  1 u0_a211 u0_a211 159744 May 24 16:47 home-assistant_v2.db
-rw-------  1 u0_a211 u0_a211      0 May 24 15:49 scenes.yaml        
-rw-------  1 u0_a211 u0_a211      0 May 24 15:49 scripts.yaml
-rw-------  1 u0_a211 u0_a211    161 May 24 15:49 secrets.yaml 
drwx------  2 u0_a211 u0_a211   4096 May 24 16:04 tts

Everything is alright?

Another question, is it possible to start the esphome just like you did with the mosquitto, nodered and home assistant through pm2? And how would it be? I did some research before asking you but I didn’t find it.

Files and permissions looks fine. To run esphome dashboard installed in venv with pm2:

pm2 start /data/data/com.termux/files/home/esphome/bin/esphome --interpreter=/data/data/com.termux/files/home/esphome/bin/python -- /data/data/com.termux/files/home/config/ dashboard

Dashboard is on
Use pm2 save if everything is ok.

@vladosam This all works automatically, thanks for the help of esphome, now he starts alone and never knows how to do it, I am very noob and I have a lot of difficulty, you really helped me a lot, many times thank you very much! Now I will look for how to install hacs!

I LOVE YOU @vladosam

1 Like

I’m trying to install a custom button Lovelace card into my Termux based HASS.
I’m already very confused about the ‘standard’ Lovelace customisation file requirements.
If anyone could give me a list of the all files required, their names locations and example content to get a custom card working, I’d be very grateful.

What custom button are you trying to install?

  1. Download the button card from github (manual install).
  2. Place the file in your config/www folder.
  3. Go to Configuration > Lovelace Dashboards > Resources (icon on botom) > plus icon
  4. In url field add /local/button-card.js resource type Javascript module
  5. On home screen > configure ui > Raw configuration editor
  6. I used blink example from custom button github
    If you paste bad yaml in raw editor you can break lovelace. Maybe it’s better to use lovelace yaml mode.

I got thru the first five steps ok and discovered the raw editor and looked at the config it contains.

At first I was confused by the inverted nature of the config; eg the title comes at the end of a section.

But I’m uncertain where and what to put for the button card config.

Could you post what you configured in a little context so I can figure out where it goes.

Happy Lockdown :slight_smile:

Under cards. Just watch for indentation. Button code begins with - type: ‘custom:button-card’
and ends with operator: default.

        title: Input boolean
        type: entities
      - type: 'custom:button-card'
        color_type: card
        entity: input_boolean.test2
        name: Intruder Alert
          - color: red
            icon: 'mdi:alert'
                - animation: blink 2s ease infinite
            value: 'on'
          - color: green
            icon: 'mdi:shield-check'
            operator: default
      - entities:
          - entity: light.bed_light_2
          - entity: light.ceiling_lights_2

Wow, works OK.
Thanks a bunch; you’re a star…

1 Like

Do you know how can I use / install the Snapshot feature without I’m running it on Android too thanks to this post.

And I’d like to make a backup in case of loss.

You can’t install supervisor on termux. You can copy .homeassistant folder as a backup solution.

1 Like

Only that is enough? If I want to restore I just copy that, install the dependencies and I’m done?