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

Hi, I have trouble setting up the hass on Android (Xiaomi Note 4).
I followed the tutorial same as @Antonio_CM a few messages up.
After running mosquito, configurator and hass with pm2 and typing pm2 logs hass I had this output:

[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:                
1|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:           
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_2) [homeassistant.loader] Loaded sun from homeassistant.components.sun             1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_1) [homeassistant.loader] Loaded system_health from homeassistant.components.system_health         
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_3) [homeassistant.loader] Loaded updater from homeassistant.components.updater    
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_2) [homeassistant.loader] Loaded zeroconf from homeassistant.components.zeroconf   
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_0) [homeassistant.loader] Loaded zone from homeassistant.components.zone           
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_4) [homeassistant.loader] Loaded input_boolean from homeassistant.components.input_boolean            
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_2) [homeassistant.loader] Loaded input_datetime from homeassistant.components.input_datetime                  
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_0) [homeassistant.loader] Loaded input_text from homeassistant.components.input_text               
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_3) [homeassistant.loader] Loaded input_number from homeassistant.components.input_number            
1|hass     | 2020-05-21 14:42:57 INFO (SyncWorker_5) [homeassistant.loader] Loaded input_select from homeassistant.components.input_select                           
1|hass     | 2020-05-21 14:42:57 INFO (MainThread) [homeassistant.bootstrap] Setting up {'system_log'}                               
1|hass     | 2020-05-21 14:42:57 INFO (MainThread) [homeassistant.setup] Setting up http                                             
1|hass     | 2020-05-21 14:42:57 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.                      
1|hass     | 2020-05-21 14:42:57 INFO (MainThread) [homeassistant.setup] Setting up system_log                                       
1|hass     | 2020-05-21 14:42:57 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds.                
1|hass  | 2020-05-21 14:42:58 INFO (MainThread) [homeassistant.setup] Setting up recorder                                            
1|hass  | 2020-05-21 14:42:58 INFO (MainThread) [homeassistant.setup] Setting up webhook                                             
1|hass  | 2020-05-21 14:42:58 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds.                      
1|hass  | 2020-05-21 14:42:58 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=3 from 2020-05-21 11:47:04.843011)                                                                                                                      
1|hass  | 2020-05-21 14:42:58 INFO (MainThread) [homeassistant.setup] Setting up alexa                                               
1|hass  | 2020-05-21 14:42:58 INFO (MainThread) [homeassistant.setup] Setup of domain alexa took 0.0 seconds.                        
1|hass  | 2020-05-21 14:42:58 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.7 seconds.                     
1|hass  | 2020-05-21 14:42:58 INFO (SyncWorker_1) [homeassistant.loader] Loaded google_assistant from homeassistant.components.google_assistant                                                                                                                           
1|hass  | 2020-05-21 14:42:58 INFO (SyncWorker_1) [homeassistant.loader] Loaded camera from homeassistant.components.camera          
1|hass  | 2020-05-21 14:42:58 INFO (SyncWorker_4) [homeassistant.loader] Loaded media_player from homeassistant.components.media_player                                                                                                                                   
1|hass  | 2020-05-21 14:42:58 INFO (SyncWorker_4) [homeassistant.loader] Loaded device_tracker from homeassistant.components.device_tracker                                                                                                                               
1|hass  | 2020-05-21 14:42:58 INFO (SyncWorker_5) [homeassistant.loader] Loaded homekit from homeassistant.components.homekit        
1|hass  | 2020-05-21 14:42:58 INFO (SyncWorker_0) [homeassistant.util.package] Attempting install of PyTurboJPEG==1.4.0 

And couldn’t access my phone’s IP:8123 via browser. (maybe wrong port? which should I type?)

Now I’m following the tutorial here. Node-red and mosquito run with no trouble. After typing hass it started installing and now for ~2 hours it’s stuck on PyTurboJPEG (same as in pm2 logs)
CMD output below:

(...)
2020-05-21 15:08:26 INFO (SyncWorker_4) [homeassistant.loader] Loaded input_number from homeassistant.components.input_number        
2020-05-21 15:08:26 INFO (SyncWorker_0) [homeassistant.loader] Loaded input_select from homeassistant.components.input_select        
2020-05-21 15:08:26 INFO (MainThread) [homeassistant.bootstrap] Setting up {'system_log'}                                            
2020-05-21 15:08:26 INFO (MainThread) [homeassistant.setup] Setting up http                                                          
2020-05-21 15:08:26 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.                                   
2020-05-21 15:08:26 INFO (MainThread) [homeassistant.setup] Setting up system_log                                                    
2020-05-21 15:08:26 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds.                             
2020-05-21 15:08:53 INFO (MainThread) [homeassistant.setup] Setting up recorder                                                      
2020-05-21 15:08:53 INFO (MainThread) [homeassistant.setup] Setting up webhook                                                       
2020-05-21 15:08:53 INFO (MainThread) [homeassistant.setup] Setup of domain webhook took 0.0 seconds.                                
2020-05-21 15:08:53 WARNING (Recorder) [homeassistant.components.recorder] Ended unfinished session (id=5 from 2020-05-21 13:06:16.411229)                                                                                                                                
2020-05-21 15:08:53 INFO (MainThread) [homeassistant.setup] Setting up alexa                                                         
2020-05-21 15:08:53 INFO (MainThread) [homeassistant.setup] Setup of domain alexa took 0.0 seconds.                                  
2020-05-21 15:08:53 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 0.7 seconds.                               
2020-05-21 15:08:53 INFO (SyncWorker_0) [homeassistant.util.package] Attempting install of hass-nabucasa==0.34.2                     
2020-05-21 15:15:18 INFO (SyncWorker_1) [homeassistant.loader] Loaded camera from homeassistant.components.camera                    
2020-05-21 15:15:18 INFO (SyncWorker_4) [homeassistant.loader] Loaded google_assistant from homeassistant.components.google_assistant                                                                                                                                     
2020-05-21 15:15:18 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of home-assistant-frontend==20200519.0       
2020-05-21 15:15:18 INFO (SyncWorker_0) [homeassistant.loader] Loaded homekit from homeassistant.components.homekit                  
2020-05-21 15:15:18 INFO (SyncWorker_1) [homeassistant.loader] Loaded media_player from homeassistant.components.media_player       
2020-05-21 15:26:36 INFO (SyncWorker_3) [homeassistant.util.package] Attempting install of HAP-python==2.8.4                         
2020-05-21 15:26:36 INFO (SyncWorker_0) [homeassistant.loader] Loaded device_tracker from homeassistant.components.device_tracker                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        2020-05-21 15:52:04 INFO (SyncWorker_2) [homeassistant.util.package] Attempting install of fnvhash==0.1.0                            
2020-05-21 15:52:12 INFO (SyncWorker_0) [homeassistant.util.package] Attempting install of base36==0.1.1                             
2020-05-21 15:52:17 INFO (SyncWorker_3) [homeassistant.util.package] Attempting install of PyTurboJPEG==1.4.0      

I have one more question, since I’m not really into linux: what’s the difference between running

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

and just

hass

I’d appreciate any help, I’m close to giving up on this :frowning:

Stop hass if it’s running. Activate homeassistant venv if you install hass in venv.Then run

pip install --upgrade PyTurboJPEG==1.4.0

it could take some time to install that.

1 Like

Thanks a lot, this worked for me, I managed to install everything and run it with pm2. My server is running :slight_smile:

In fact it took 4 HOURS! Is my old smartphone really that slow… :confused:

It needs to compile numpy from source. And that is super slow on some machines.

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 hass.io 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 hass.io together?

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

Install required packages.

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

Setup storage

termux-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

hass 

Open browser and go to 127.0.0.1:8123

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/core.py”, 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/core.py”, 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/service.py”, 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/init.py”, 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/config.py”, 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/check_config.py”, 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/thread.py”, 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/config.py”, 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/loader.py”, 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?

/data/data/com.termux/files/home/

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

/data/data/com.termux/files/home/.homeassistant/

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 127.0.0.1:6052
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.

Hi,
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
        state:
          - color: red
            icon: 'mdi:alert'
            styles:
              card:
                - 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