Beginner’s guide to Home Assistant – Installation

Home Assistant is an open-source home automation platform. It allows to track and control different types of smart home devices and online services. You can manage devices like switches, lights, and services like IFTTT. To find a list of all available components that Home Assistance support, you can go here.

Home Assistant can be set up on multiple devices. The most common and convenient is the Raspberry Pi. There are also different installation processes but, the one I preferred is the All-In-One Installer because it still allows using the Raspberry Pi for other things.

DISCLOSURE: Some of the links below, are affiliate links, meaning, at no additional cost to you, I will earn a commission if you click through and make a purchase.

Home Assistant Installation

For the installation, we will need the following:

  • Raspberry Pi 3 Buy on Amazon
  • SD card Buy on Amazon
  • Raspbian Jessie Download (Raspbian Stretch not supported at the time of this guide)
  • If you need a case, I recommend the Smraza case which comes with heatsinks, a fan and a power adapter with an on an off switch. Buy on Amazon

Step 1 – SSH to Raspberry Pi and update packages

Log in to the Raspberry Pi via SSH using PuTTY and before you install Home Assistant, run the command sudo apt-get update and sudo apt-get upgrade to make sure that you have all the latest packages installed.

NOTE: By default, Raspbian Jessie has SSH disabled so to enable it in the Lite version, you will need to save a text file named ssh in the boot partition of the SD card. For references, you can check the article, Get started with the Raspberry Pi 3.

Step 2 – Install Home Assistant

Install Home Assistance using the All-In-One Installer with the following command

$ 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

The installation, if you are doing it in a Raspberry Pi 3 can take a couple of hours. Yes, you read that correctly. 1 to 2 hours. The All-In-One Installer not just installs the Home Assistant server but also support for MQTT with WebSockets, Z-Wave, and the OpenZWave Control Panel.

After the installation runs for about 10 to 15 minutes, it will prompt you to enter your Pi’s password. After that, it will continue running for a while so sit back and relax. When the installation finish, the Raspberry Pi will restart.

Step 3 – Verify connection

Home Assistant is accessible from a browser by typing, http://, then, the Raspberry Pi’s IPaddress and then the port: 8123. The address would look like this, http://192.168.__.__:8123.

Home Assistant web interface
Home Assistant web interface

Step 4 – Change the NetBIOS name

This part is optional but, I do recommend doing it. The default NetBIOS name for a Raspberry Pi is, raspberrypi. If you have or plan to have multiple Raspberry Pis, you want to give them a unique name. Run the following commands to make the changes: sudo nano /etc/hostname. Remove the default name and enter the desired name. Then, Press Ctrl+Xto exit and then press Y to save the changes.

HA Hostname
Remove the default name and enter the desired name.

Next, type the command, sudo nano /etc/hosts and change the name next to 127.0.1.1. Then, Press Ctrl+X to exit and then press Y to save the changes.

HA Host
Change the name next to 127.0.1.1.

To apply all changes, reboot the Pi with the command, sudo reboot

Step 5 – Set up Samba access

Set up Samba file sharing in the Raspberry Pi 3
Set up Samba file sharing in the Raspberry Pi 3

Samba, is going to allow us to access the Raspberry Pi folders on a Windows computer and quickly manage the Home Assistant configuration files.

The Home Assistant configuration files are located at /home/homeassistant/.homeassistant. We are going to set up this path in the Samba configuration file so like that we can access it directly on a Windows computer.

To install Samba, enter the command, sudo apt-get install samba samba-common-bin. Now, we need to configure the Samba configuration file so enter the following command, sudo nano /etc/samba/smb.conf .

The Samba configuration file it is well documented. You can go through it and enable the options you would like. You can also remove everything by pressing and holding Ctrl+K and pasting the following configuration:

[global]
netbios name = raspberrypi
server string = The Pi File Center
workgroup = WORKGROUP
hosts allow =
remote announce =
remote browse sync =

[HOME ASSISTANT]
path = /home/homeassistant/.homeassistant
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = no
public = yes
create mask = 0777
directory mask = 0777
force user = root
force create mode = 0777
force directory mode = 0777
hosts allow =

Here is a short explanation of what the code above means:

  • workgroup: This is the domain that the Samba server will be part of. By default, Windows has the workgroup set as WORKGROUP
  • path: The path for the Home Assistant configuration files
  • writeable: If set to yes, it will allow the folder to be writeable
  • create mask and directory mask: When set to 0777 allows the user to read, write and execute
  • public: If set to no, it will only allow valid users to access the shared folder

Press Ctrl+X to exit and then press Y to save the changes. Next, you need to set up a Samba password. Enter the following command, sudo smbpasswd -a pi. Enter a new password when prompted. You can use the same password as your Raspberry Pi user but for security, enter a different password.

Last but not least, restart the Samba service to apply all changes using the command, sudo service smbd restart.

To access the Samba shared folder on a windows computer, open Windows File Explorer and click on Network. The Raspberry Pi shared folder will now be displayed. Click on it and enter your Pi’s username and the Samba password. After that, you can access the Home assistant configuration.yaml file and quickly make any changes.

Raspberry-Pi-shared-folder

Step 6 – Password Protect Home Assistant

It is always a good idea to set up a password for the Home Assistant web interface, especially when planning to access it from outside your home network.

To set up a password, we will need to access the Home Assistant configuration.yaml file. Open the Home Assistant shared folder by going to the Windows File Explorer > Network. Then, click on the RASPBERRYPI shared drive and, click on the Home Assistant folder. Open the configuration.yaml file using an application like Notepad++. Under HTTP, you will see the line #api_password: Password. Remove the hash #” to uncomment the line and enter a new password. The line would now look somewhat like this: api_password: YourNewPassword.

configuration change password
Uncomment by removing the hash “#” and enter a new password. It should look somewhat like this: api_password: NewPassword

Save the file and then restart Home Assistant with the command, sudo systemctl restart home-assistant.service. Reopen the Home Assistant web interface and, you will be prompted to enter a password.

Home Assistant password prompt
Home Assistant Log in screen

OK, so Home Assistant is now installed. We configured Samba and, now we have access to the configuration files from a Windows computer. We also password protected the Home Assistant web interface. In future articles, I will cover how to setup DuckDNS, Let’s Encrypt, !secrets and I will also go over the configuration.yaml file so you can have a better understanding of how it works.


Don’t forget to follow me on social media and YouTube, so you do not miss any future written guides, tutorial videos and product reviews.

WANT TO SUPPORT JUANMTECH?

You can do so now on Patreon and Buy Me A Coffee