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

Have you run it for a longtime? How stable it is and responsive?

I was looking at it as a to introduce / show Hass to friends and family since most already have a Android tablet or box.

I could get away without Mosquitto since I can connect them to my broker for the time being but Hass has to run flawless.

Surprisingly stable. 48 hours absolute stable on a samsung A3 2015 with 4 services all running simultaneously at 0% cpu load(?). Tested Android IP webcam installed on same device, full hd no problem, led, front/backcam switch and stuff in near realtime. Tasker communication went well too… just had some 2 hours delayed mgtt text to speech messages from mosquitto and thought i alrdy got hacked :smiley: installed the configurator for HA so i can edit the conf files directly from frontend. Hate to code on android display. Now im trying to make my old s3 mini running without battery 24/7… who needs a pi, webcam, alexa + lots of sensors if you got an old smartphone? I see big potential here.

4 Likes

Wow amazing. Gonna try to find the time to try it in one of my tv-boxes. I had hass.io running on a pi zero flawless besides the huge amount of time it time to reboot

You can access the android via PC easy and even use the keyboard and mouse for editing.

1 Like

y, found teamviewer (-host, special version for my samsung phone) + ftpdroid is the best solution here. Thanks for pointing in this direction

btw i failed, sry for beeing stupid. timestamp is alright in mosquitto. Didnt see the website i used to calculate timestamp showed utc, not utc+1/2 (mesz)

WOW! It’s amazing! Thanks !

Would z-wave devices work with a OTG cable and a ZWave stick ?

2 Likes

Thank you. This seems to work reasonably well.

I was curious if there is a way to use SSH for local (and possibly remote) connections into the Android device/Termux.

Allow me to explain: I had a Remix Mini that runs Android, and was able to install HA per instructions given here. However, it is currently wired to my router and hooked up to my TV. I’d like the freedom of just using my laptop so I am not stuck sitting in front of my TV (example - weather is supposed to be gorgeous this weekend…it would be nice to sit on my porch with my laptop to continue configuring/automating, etc.

Also, if I can teach myself how to do it securely, I wouldn’t mind doing things remotely, too (such as during my lunch break at work).

Yes you can. https://termux.com/ssh.html

Is there a way to have this all run upon boot?

1 Like

Yes there is a way. :slight_smile: https://github.com/termux/termux-lboot/blob/master/README.md
On google play there is a paid version of termux boot and on f-droid you can get it for free. Or you can use pm2 just adjust it for sshd.

I tried Termux boot prior to posting here. Following their instructions, you’re supposed to create a file. I kept getting errors in trying to do so. Some poking around on the internet pointed to use if sudo, but I can’t seem to use that. And internet searches have yet to pull up useful info regarding this.

No need for sudo. Start termux.
mkdir .termux
mkdir .termux/boot
Make file with nano or vi.
nano start-sshd
Put this in file:
termux-wake-lock
sshd
Of course you need to install ssh with pkg install openssh.

1 Like

I would also need to include all the commands for starting mosquitto, node-red, and has too, yes?

You can run hass, mosquitto and node-red with termux boot but i think it is better to run those programs with pm2. Because if you release wake-lock and start termux again hass and other programs in boot won’t start in this new termux. And with pm2 you can easy view all logs for started programs. So start hass with:

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

Check if hass started status must be online and save it.

pm2 show hass
pm2 save

Edit .bashrc to start all programs when termux starts.

nano ~/.bashrc
pm2 resurrect

See my first post here to see how to start mosquitto and node-red.

Thank you.

I am still learning/reteaching myself stuff.

That said, any thoughts whey Termux didn’t start on boot (let alone sshd) when I followed the instructions given by THEM?

Termux-Boot only starts applications and scripts within termux app. To start termux at phone boot use something like this.

1 Like

Thank you for that clarification.

I had tried Tasker before, but to no avail. I will try this one.

so I got AutoStart working, and Termux to start up with sshd and homeassisant. And it works great. Thank you for your help so far.

However, there’s another quirk I noticed. As I mentioned, the whole point of this was to be able to ensure that I can ssh into my device, while not necessarily being tethered to it (like being able to sit outside with my laptop when the weather is nice, and leave it connected/powered where it is). So whenever I use ssh and login, it goes through the process of starting up everything, which then restarts homeassistant, meaning that the front end has to reload. I wanted Termux to run the scripts upon SYSTEM BOOTUP, not every time I open an ssh terminal. I used pm2 in the bashrc as suggested. Did I do something incorrectly? Or do I not understand something?

It isn’t the end of the world if I can’t address this. Unless there are potential issues with restarting homeassistant that often (as I think this seems to be doing).

I’m glad this works for you. You need to exclude pm2 resurrect command to execute when login with ssh. Replace pm2 resurrect in .bashrc with this:

if [ "x${SSH_TTY}" = "x" ]; then
pm2 resurrect
fi

Log out and then log in or reload bashrc with source ~/.bashrc.

2 Likes

thank you. works like a charm now.