Got an old Android phone and don’t want to buy a Raspberry Pi or a PC to host Home Assistant? This tutorial is for you!
Requirements: Android Phone – No Root Required
Credit: Special thanks to George-Seven for the Termux-Udocker repository.
Note:
- Although Termux is also available on the Play Store, according to the Termux developers, the version on F-Droid is the most stable.
- After installing Termux, it is recommended, though not required, to install OpenSSH and enable remote access from a PC for easier interaction with the Termux Terminal. For details on setting up Termux remote access. See more: Termux Remote Access Guide.
# Update & Upgrade Termux packages
pkg update && pkg upgrade
# Install git
pkg install gitClone HomeAssistant-Termux:
git clone https://github.com/huytungst/HomeAssistant-Termux.gitGo to the root directory of HomeAssistant-Termux:
cd HomeAssistant-TermuxInstall Udocker from the cloned repository:
./install_udocker.shRun the script home-assistant-core.sh:
./home-assistant-core.shWait about 10 minutes, then you can access Home Assistant on port 8123 (http://localhost:8123/)
Also, you can install and run the Python Matter Server to enable Matter compatibility.
Note: To keep both containers (Home Assistant Core and Python Matter Server) running at the same time, start each one in a separate Termux session. Two easy ways are either opening two Termux terminal sessions (using the Termux GUI) or using the
screencommand. See more
Run the script matter-server.sh:
./matter-server.shThen, enable the Matter Integration in Home Assistant and connect them using the WebSocket URL:
ws://localhost:5580/wsTo keep both containers (Home Assistant Core and Python Matter Server) running at the same time, start each one in a separate Termux session. Two easy ways are either opening two Termux terminal sessions (using the Termux GUI) or using the screen command.
- Open Termux.
- Start the first container in the initial Termux session.
- Open a new Termux session by swiping from the left edge to open the drawer, then selecting New Session.
- In this new session, start the second container.
If you prefer to use screen to manage multiple sessions in a single Termux window:
- Open Termux and install
screenif you haven't already:pkg install screen
- Start
screenand create a new session:screen -S container1
- Start the first container in this
screensession. - To create a new screen session, detach from the current session by pressing
Ctrl + Afollowed byD. - Start a new session for the second container:
screen -S container2
- Start the second container in this new session.
- To switch between sessions, use:
screen -r container1 # For the first container screen -r container2 # For the second container
This completes the setup for running Home Assistant Core and the Matter Server on Android without root.