This tutorial describes how to install Home Assistant Core on Raspberry Pi to get started with Home Assistant and set up the development environment.
Home Assistant is a Python-based open-source smart home system. It supports connection to smart devices across different platforms, which allows you to control a connected home with one system.
We use Home Assistant Core (recommended for developers) to install Home Assistant OS and runs the program in Ubuntu Server. For more information about other installation methods, see the instructions on Home Assistant.
Used to install the software and connect to Raspberry Pi using Terminal.
Used to install Ubuntu Server and Home Assistant.
Connect Raspberry Pi to the internet.
Used to install Ubuntu Server and store files and data.
Connect the microSD card to the computer.
You have installed Python on your system. Python 3.8.0 or later is recommended.
Hardware/Software | Description |
---|---|
Computer | A Mac computer |
Device to run Home Assistant | Raspberry Pi 3 or later This tutorial uses the 64-bit Raspberry Pi 4, with 8 GB RAM. |
Environment | Ubuntu Server 20.04.2 LTS |
Wireless router | One piece |
microSD card | One piece |
SD Card reader | One piece |
You can connect Raspberry Pi to the internet through a wired Ethernet connection (recommended) or a Wi-Fi network.
myhomewifi
field to the SSID of your router and the S3kr1t
field to the password of your router.wifis:
wlan0:
dhcp4: true
optional: true
access-points:
myhomewifi:
password: "S3kr1t"
192.168.1.140
as an example.ssh ubuntu@192.168.1.140
Note: The default username and password of Ubuntu Server both are
ubuntu
.
Execute the following three commands respectively to install dependencies. The installation process will take some time.
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y python3 python3-dev python3-venv python3-pip libffi-dev libssl-dev libjpeg-dev zlib1g-dev autoconf build-essential libopenjp2-7 libtiff5 --fix-missing
Create a directory for the installation of Home Assistant.
mkdir ~/hass
Create and activate the virtual environment for Home Assistant.
cd ~/hass
python3 -m venv .
source bin/activate
python3 -m pip install wheel
pip3 install homeassistant
Execute the following command to start Home Assistant.
hass
When you start Home Assistant for the first time, the system will create ~/.homeassistant
directory to store configuration files and install required dependencies. This process will take some time.
Visit http://192.168.1.140:8123 in a browser by using a device in the same LAN. If the Home Assistant homepage appears, it indicates that installation is successful.
Note: The IP address here is only for demonstration. Use your Raspberry Pi’s IP address.
We use Samba to share .homeassistant
directory in the LAN. You can modify the .homeassistant
file directly on your computer, which will help the development of drivers.
sudo apt-get install samba samba-common-bin
smb.conf
file.
Note: Yo must specify an absolute path to
smb.conf
, such as/home/ubuntu/.homeassistant
.
sudo vi /etc/samba/smb.conf
[pi]
path = /home/ubuntu/.homeassistant
writeable=Yes
create mask=0777
directory mask=0777
public=no
Note: When you use the
sudo smbpasswd -a
command to create a Samba user, the account must be a Linux system account, such as ubuntu.
sudo smbpasswd -a ubuntu
a123456
.sudo systemctl restart smbd
Once Samba is installed, the development environment is set up.
Open Finder on your Mac.
In the top-left corner of the screen, click Go > Connect to Server.
In the dialog box, enter your Raspberry Pi’s IP address and click Connect.
smb://192.168.1.140/pi
Note: The IP address here is only for demonstration. Use your Raspberry Pi’s IP address.
In the dialog box, enter the account and password of the Samba user. See the following example.
Click Connect to access the Home Assistant folder shared with Raspberry Pi.
You can access the Home Assistant folder through Samba and proceed with the development of drivers. For more information, see Develop Tuya-Compatible Home Assistant Drivers.
Is this page helpful?
YesSuggestions