Home Assistant is a home automation server fully developed in the Python language, so it is possible to install it on an Orange Pi. For this tutorial, I used an Orange Pi+ 2e equipped with 16GB of memory eMMC working Armbian. Home Assistant has evolved a lot in one year. It is now possible to install it (or test it) in a virtual environment. It is also possible to test it through Docker without any (almost) installation. To do this, read the article how to test home automation software easily with Docker.
Install Home Assistant on Armbian
Since December 2016, it is recommended to install HASS in a virtual Python environment. This installation makes it possible to isolate the home automation server from the rest of the Linux distribution. This configuration increases the security of the system. In return, maintenance is a bit more complicated (and installation if done manually). It is possible to manually install Home Assistant by following this tutorial. However, I advise you to use the All-In-One installation script developed for the Raspbian distribution of Raspberry Pi.
What does the All-In-One Installer script do?
The All-In-One script (detailed here) takes care of installing and configuring the HASS home automation server:
- Created all necessary directories
- Created the necessary accounts and groups
- Installs dependencies (Python, Linux)
- Configures a Python virtual environment to run Home Assistant and its components regardless of the administrator account (better security)
- Installs Mosquitto broker with web support (ports 1883 and 9001)
- Created and installed Python-openzwave in the virtual Home Assistant environment
- Created the openzwave-control-panel in / srv / homeassistant / src / open-zwave-panel
- Configures the SystemD service so that HASS starts automatically at system startup
Install HASS with the All-In-One script
Log in to your Orange Pi (or Raspberry Pi) in SSH with an administrator account (root) and execute the following command that launches the installation script suited to the Raspberry Pi (and also works smoothly on Orange Pi).
curl -O https://raw.githubusercontent.com/home-assistant/fabric-home-assistant/master/hass_rpi_installer.sh && sudo chown pi:pi hass_rpi_installer.sh && bash hass_rpi_installer.sh
Installation may take some time (especially if the system needs to be updated). Count about 1 hour on an Orange Pi + 2e.
Useful commands to know
At the end of the installation, the system will restart automatically. Home Assistant is not a war lightning at startup. Depending on the configuration, HASS may take a few minutes to start. At first boot, there may also be some dependencies to install. So we have to be patient.
Learn about the state of the server with the command journalctl
As HASS starts automatically at startup, we are (a little) blind. It is possible to know the state of the server using several Linux commands. First of all one can know the state of the server with the command systemctl . The following command allows to know the status of the server (its status) as well as possible errors in the configuration file.
sudo systemctl status home-assistant
[box type = “info” align = “” class = “” width = “”] Please note that the command must be preceded by a sudo.[/wpsm_box]
By replacing the status argument, the systemctl command also allows you to restart the server (restart) or stop it.
The command journalctl is the command associated with systemctl, which allows you to display the execution log of it.
sudo journalctl -fu home-assistant
- -u specifies the service
- -f allows to follow (follow) in real time the log of the service
Type CTRL + C on the keyboard to interrupt the execution of the command.
Finally, the log (log) of HASS can be tracked in real time using the linux tail command with the -f (follow)
tail -f /home/homeassistant/.homeassistant/home-assistant.log
That’s it. To connect to the server, as usual, open a web browser and enter the IP address followed by port 8123. From Armbian, type localhost: 8123 in the address bar.
Update Home Assistant
Since HomeAssistant is running in a virtual (and protected) Python environment, the upgrade procedure is a bit more complicated. Connect SSH to your Raspberry Pi or Orange Pi and then run the following command to switch users
sudo su -s /bin/bash homeassistant
Then change the source of the Python virtual environment
Finally, launch the update
pip3 install --upgrade homeassistant
Execute the exit command to disconnect from the homeassistant account. The update is complete.
Here is an excerpt of an update (version 0.44.1)
pi@orangepiplus2e:~$ sudo su -s /bin/bash homeassistant [sudo] Mot de passe de pi : homeassistant@orangepiplus2e:/home/pi$ source /srv/homeassistant/homeassistant_venv/bin/activate (homeassistant_venv) homeassistant@orangepiplus2e:/home/pi$ pip3 install --upgrade homeassistant Collecting homeassistant Downloading homeassistant-0.44.1-py2.py3-none-any.whl (7.0MB) 100% |████████████████████████████████| 7.0MB 22kB/s Collecting pyyaml<4,>=3.11 (from homeassistant) Using cached PyYAML-3.12.tar.gz Collecting requests<3,>=2 (from homeassistant) Downloading requests-2.14.2-py2.py3-none-any.whl (560kB) 100% |████████████████████████████████| 563kB 216kB/s Collecting async-timeout==1.2.0 (from homeassistant) Using cached async_timeout-1.2.0-py3-none-any.whl Collecting pytz>=2017.02 (from homeassistant) Using cached pytz-2017.2-py2.py3-none-any.whl Collecting voluptuous==0.10.5 (from homeassistant) Downloading voluptuous-0.10.5.tar.gz (41kB) 100% |████████████████████████████████| 51kB 372kB/s Requirement already up-to-date: pip>=7.1.0 in /srv/homeassistant/homeassistant_venv/lib/python3.5/site-packages (from homeassistant) Collecting jinja2>=2.9.5 (from homeassistant) Using cached Jinja2-2.9.6-py2.py3-none-any.whl Collecting typing<4,>=3 (from homeassistant) Using cached typing-3.6.1.tar.gz Collecting aiohttp==2.0.7 (from homeassistant) Using cached aiohttp-2.0.7.tar.gz Collecting chardet==3.0.2 (from homeassistant) Using cached chardet-3.0.2-py2.py3-none-any.whl Collecting MarkupSafe>=0.23 (from jinja2>=2.9.5->homeassistant) Using cached MarkupSafe-1.0.tar.gz Collecting multidict>=2.1.4 (from aiohttp==2.0.7->homeassistant) Using cached multidict-2.1.4.tar.gz Collecting yarl<0.11,>=0.10.0 (from aiohttp==2.0.7->homeassistant) Downloading yarl-0.10.2.tar.gz (127kB) 100% |████████████████████████████████| 133kB 368kB/s Building wheels for collected packages: pyyaml, voluptuous, typing, aiohttp, MarkupSafe, multidict, yarl Running setup.py bdist_wheel for pyyaml ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/2c/f7/79/13f3a12cd723892437c0cfbde1230ab4d82947ff7b3839a4fc Running setup.py bdist_wheel for voluptuous ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/04/da/a7/52954cfc62b4a5d72cbdab1eceec279ab7511acaddb00e71e7 Running setup.py bdist_wheel for typing ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/b3/54/d1/d7ad0895b6f57c608afdf3ec5d2339c5d18ffcf2c2e0e0d9aa Running setup.py bdist_wheel for aiohttp ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/64/25/7b/c11ddc85128d02e901339c5db705a026189f0e485178cffbe5 Running setup.py bdist_wheel for MarkupSafe ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/88/a7/30/e39a54a87bcbe25308fa3ca64e8ddc75d9b3e5afa21ee32d57 Running setup.py bdist_wheel for multidict ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/9a/61/45/1c719c9470d396d05a0f220daa36090e1d0d91c77f7db2ea24 Running setup.py bdist_wheel for yarl ... done Stored in directory: /home/homeassistant/.cache/pip/wheels/5f/0b/0c/952fe41b59c732f5c102d6467446299fe6963be8bd96e933f9 Successfully built pyyaml voluptuous typing aiohttp MarkupSafe multidict yarl Installing collected packages: pyyaml, requests, async-timeout, pytz, voluptuous, MarkupSafe, jinja2, typing, chardet, multidict, yarl, aiohttp, homeassistant Successfully installed MarkupSafe-1.0 aiohttp-2.0.7 async-timeout-1.2.0 chardet-3.0.2 homeassistant-0.44.1 jinja2-2.9.6 multidict-2.1.4 pytz-2017.2 pyyaml-3.12 requests-2.14.2 typing-3.6.1 voluptuous-0.10.5 yarl-0.10.2 (homeassistant_venv) homeassistant@orangepiplus2e:/home/pi$ exit exit pi@orangepiplus2e:~$
- Home Assistant. Install the snap on Synology NAS on an Ubuntu Virtual Machine
- Home Assistant. Essential plugins to install. Samba, HACS, File Editor, MQTT Mosquitto
- Home Assistant Community Store (HACS), easily install themes and components
- Home Assistant. Get started on Raspberry Pi 4. Procedure 2020
- ESP8266 + DHT22 + MQTT: make a connected object IoT and include it in Home Assistant
- How to Include RFLink Radio Home Automation Devices at Home Assistant (HASS)