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

Hi @vladosam, thank you very much for a great tutorial!

I’m trying to run Node-RED at login but can’t figure out the best way to do this:

`Termux:Boot` doesn't start NR

/data/data/com.termux/files/home/.termux/boot/start-sshd

termux-wake-lock # seems fine
node-red --node-args="--max-old-space-size=128" -- -v # ignored
node-red # ignored
sshd # 👌 

Specifying Termux in AutoStart app *works* but opens up Termux

Enabling Goto Home screen after autostart doesn’t help.


  1. The ultimate question: How is it possible to start Node-RED on Android boot w/o opening the Termux UI? Not using Termux is even better.
  2. pm2 save saves the process list and creates a startup script to run only on Termux boot: is this correct?
  3. Is pm2 startup possible on unrooted Android? It seems to be using systemd. Probably something else can be used?
  4. Can pm2 resurrect help in any way?

Thank you for your help! :kissing_heart:

You are welcome. :slight_smile: I don’t use termux on a daily basis so when someone asks something i first need to read my tutorial :smiley: Now for your problem of starting node-red i found that you can use Termux:Boot. Add this in your start-sshd file and reboot phone.

termux-wake-lock # seems fine
termux-fix-shebang $(which node-red)
node-red --node-args="--max-old-space-size=128"
sshd

pm2 startup don’t work on android. pm2 resurrect restores applications saved with pm2 save but only when you open termux. Use Termux:Boot to solve your problem. Than you don’t need to open Termux UI.

2 Likes

Wow you are so awesome!!! Thank you!
It finally works! :clap::clap:

However, I can’t make git to work, despite it’s available in Termux:

You can’t get https://flows.nodered.org/node/node-red-contrib-git-nodes working?

1 Like

Unfortunately, nothing worked:

  • node-red-contrib-git-nodes returns git command error though everything seems to be configured correctly :man_shrugging:t4:
  • node-red-contrib-git-ui even after manual git init gives:
    Error Checking out Staging!
    fatal: not a git repository (or any parent up to mount point /) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  • node-red-contrib-github is an API wrapper that doesn’t seem to have push

UPD after restarting, the built-in git started to work (probably after manual git init inside the project) :tada::partying_face: Sweet!

You are so helpful!!! Can I ask you one last thing?
Could you advise how can I configure a reverse proxy for this NR?

https://flows.nodered.org/node/node-red-contrib-git-nodes works for me. Start node-red from command line and not from termux:boot. Once you configure ssh in github and you push something from node-red check termux and allow new connection to github.

Yeah luckily the built-in git client started to work after I restarted the device.
Thanks again for your help!

1 Like

Getting this error on Pie ROM in venv

ERROR (SyncWorker_0) [homeassistant.util.package] Unable to install package PyNaCl==1.3.0: Failed building wheel for PyNaCl
Could not build wheels for PyNaCl which use PEP 517 and cannot be installed directly

Activate venv and then try to install pynacl to get more verbose error.
pip install pynacl==1.3.0

It was just the missing make in the path. Now I realize you mentioned it earlier in the thread. Pitty you cannot edit your OP. Thanks.

Hello, is there a way to put the configuration.yaml file in another folder?
i have rooted my phone.
Thanks a lot
Stefano

This is from homeassistant docs:
If you want to use a different folder for configuration, use the config command line parameter: hass --config path/to/config

I have do this but i will receive a permission error…ù
is there also a way to run all the services and Hass when my phone turn on automatically?

Share hass config command. What folder you want to use for config? You can use autostart app for auto staring. Search this thread.

Hi @vladosam, did you tried to install docker on termux then to dockerise Hassio ?

I don’t think it is possible to install docker in termux. There is some partial success but no one got fully running docker.

1 Like

Indeed, check a lot of topics about docker, kernel related change necessary…

What about zwave / ZigBee dongles, can we use it with OTG cable ?

No. Not yet. https://github.com/termux/termux-packages/issues/1145

I installed home assistant 0n a smartphone android(galaxy s7) and on a android box but now after a update to 0.95 version of home hAssistant it says me that he wants pynacl 1.3.0 I tryed to install in venv but I have the same error in all device cannot locate in E: why??? How can I solve???