How to set up Home Assistant (Hass.io) as a home automation hub
Now that you have set up the hardware and flashed the software for running your hub, you need to configure both Home Assistant software and the Raspberry Pi OS.
- Login to Hass.io the first time
- Login to your Raspberry Pi via SSH
- Change the default password right now!!!!
- Enable VNC for GUI-based access to your Raspberry Pi
- Change basic security settings on your Raspberry Pi
Login to Hass.io the first time
You will now log into Hass.io from your browser window. The trick now is to figure out what IP address has been assigned to your Raspberry Pi. Unfortunately, there is not a single, consistent to do this. The process will be different depending on your network hardware and how you connected your Raspberry Pi to the network (wired vs. wireless). You will need to login to your router to figure out what IP address. The reason for this is that your router will assign an IP address to the Raspberry Pi that you plugged into it, but you cannot predict what that IP address will be. After getting logged in, though, we can assign a static IP address going forward, to ensure it is always the same, but the first time, we will have to ask the router what IP address was assigned.
If you are using Ubiquiti hardware and Unifi software to run your home network (in my opinion, a fantastic option and one I will cover in more detail in a future post), you can login to your Unifi controller, then navigate to the “Clients” page to see all of the devices on your home network.
Initially, the “name” column may be something else (like the MAC address or a random name. You can look at the Device Vendor column to see that the manufacturer is “Raspberr” to determine that, indeed, this is your Raspberry Pi. Mine is set on 192.168.1.114 (this is my IP address inside my home network, yours is very likely to be different, make a note of the IP address, you will need it later).
Naturally, I recommend you rename this device right now so that it is easy to identity in the future. Note also that I have plugged my Raspberry Pi directly into my wired network (LAN) instead of using the wireless connection. This is to maximize the speed my Raspberry Pi can respond to other devices on the network (specifically Pihole), but there is nothing wrong with setting it up on the wireless network if you prefer.
Now that we know the IP address, we can open a browser and navigate to http://192.168.1.114:8123 (port 8123 is the default port that Hass.io is set up to listen to). If you have set up everything correctly, you will see the Hass.io home screen.
Yours will not be this complicated starting out. I have added lots of sensors, switches, controls, plugins, etc to my system. I will detail how I have set up all of these various systems in future blog posts.
The important thing is that you got this far!
Login to your Raspberry Pi via SSH
Now that you know you have a working Hass.io setup, you need to be able to login to the actual OS that is installed on your Raspberry Pi.
Earlier, you found the IP address for your Raspberry Pi in your router’s clients page. We will use that IP address to login to the OS.
In Windows, installPutty. Putty is a free SSH client for Windows. You will use it to login to the command prompt for your Raspberry Pi. Don’t worry if you are not comfortable always working on the command line, I will walk you through setting up VNC so you can have a GUI interface to the Raspberry Pi.
Many things in both the Raspberry Pi and Home Assistant can be configured via the GUI, but many things cannot. You will be most effective and will be able to configure the system exactly to your liking if you begin to learn and be comfortable with the command line (specifically, the Linux shell Bash).
Open Putty and enter the following configuration values:
- Host Name (or IP address) – IP address of your Raspberry Pi, example: 192.168.1.114
- Port – 22 (the default for SSH connections)
- Connection Type – SSH
Click Open. The first time you do this, you will be asked for the username you wish to login with. By default, the Raspberry Pi has a user called “pi” with a password of “raspberry“. Don’t be shocked (this password is well-known), we are going to change this right away. If you are not familiar with Putty, you can “copy” a string to your Windows clipboard (highlight the raspberry string, right-click and select Copy, use the keyboard shortcut Ctrl+C, etc) and “paste” it by right-clicking in the Putty command window. You will not see any change since it is a password, but you can now press the Enter key and and it will log you in.
Congratulations! You are now a l33t h4ck32!.
Change the default password right now!!!!
I cannot stress this enough. The default password for the Raspberry Pi is raspberry. This is extremely well known and you must not leave it as the default or your system will get hacked by automated scanning tools that are constantly scanning all IP addresses and trying all well-known logins.
Don’t worry yet, though, your home network is an isolated bubble. You router is presenting a single IP address to the Internet (assigned by your Internet Service Provider, ISP). Your router is providing a local, internal network that all of your devices connect to. The IP address range for internal networks is typically 10.x.x.x, 172.16.x.x or 192.168.x.x. Your router is “protecting” your internal network and not broadcasting what the internal IP addresses of your devices are. Therefore, when automated tools try to login, they are blocked because they cannot ping the actual IP addresses of your devices, just the router (another good reason to change the default password on your router’s administration page as well).
However, you shouldn’t rely on just your router to protect you. You may decide to make your Raspberry Pi available on the Internet (though I will show you a different way to do this with a VPN) so you can access it remotely. You will definitely need to have set a different password to help ensure you do not get hacked.
Some sites will recommend changing the default username as well since pi is so well known. However, I have had several services on my Raspberry Pi break over the years because they expect the “pi” user to exist (not the best coding practice to expect a certain username to exist, but it happens). Therefore, I am not advocating changing the username at this time.
In addition, the best way to lock down your Raspberry Pi is via a SSH key, but I have not done this yet. I will update this post in the future when I have set this login type myself.
I highly recommend you store your username and password in a password management system (to help encourage you to generate strong passwords and not re-use passwords over and over again). I recommend you use LastPass (affiliate link), but there are numerous other ones that are good too.
As stated on the Raspberry Pi’s documentation page, here is how you change your password.
- Login to your Raspberry Pi via SSH (Putty)
- Type in passwd and press Enter
- Enter your existing password (raspberry) and press Enter
- Enter your new password and press Enter
- Enter your new password again and press Enter
- You will see “passwd: password updated successfully”
Enable VNC for GUI-based access to your Raspberry Pi
The vast majority of my examples going forward can be accomplished using just the SSH connection and the Bash shell on the Raspberry Pi. However, you may also want a GUI to more easily perform administration of your Raspberry Pi (some things are just easier with a GUI).
By default, your Raspberry Pi will not have a way to remote login to a GUI (you would have to plug an external monitor into the HDMI port to see the GUI. Therefore, you must install a remote desktop client.
In my opinion, the VNC Viewer is the easiest and best way to remote desktop from your Windows PC to your Raspberry Pi. VNC is free for home (non-commercial use) for up to 5 remote computers and 3 users.
You will need to do 2 installs, one of the VNC Viewer on your Windows PC and one on the Raspberry Pi of the VNC Server.
As stated on the Raspberry Pi documentation page, here are the instructions for how to install & set up.
- Login to your Raspberry Pi via SSH (Putty)
- Type in sudo apt-get update and press Enter
- sudo is the command in Linux to temporarily elevate your privileges so you can do privileged tasks like install new software
- apt-get is the command in Linux (the Ubuntu/Debian distribution, specifically) to install a package via the built-in package system. APT makes is extremely simple to install, update & uninstall software from your Linux OS.
- update is to ensure you have the latest of all installed packages before you continue (having outdated packages is often the cause of failed installations and running of software)
- Type in
sudo apt-get install realvnc-vnc-server realvnc-vnc-viewerand press Enter
- This will install both the VNC server & viewer
- Type in sudo raspi-config and press Enter
- This will open the configuration options for your Raspberry Pi
- Press the Down arrow key until you get to Interfacing Options and press Enter
- Press the Down arrow key until you get to VNC and press Enter
- Use the Left or Right arrow key and select Yes and press Enter
- Press the Enter key to confirm that VNC Server is enabled
- Download the VNC Viewer for Windows and install it
- Run VNC Viewer from the Start Menu
- Type in the IP address of your Raspberry Pi and press Enter
- The first time you login, you will be asked for the username (pi) and the password you set when you changed it
- If successful, you will see the Linux GUI that is installed on your Raspberry Pi
Change basic security settings on your Raspberry Pi
At this point, you have a basic Raspberry Pi server set up. You must now decide how much effort you want to put into securing your system. The Raspberry Pi documentation does a great job giving you several options for how to secure your Raspberry Pi. At this time, I won’t recommend you do any specific settings (since they will be a whole other article), but feel free to add them as you see fit at this time.
As long as you keep your Raspberry Pi inside your local network and do not expose it to the Internet directly, you are relatively protected by your router & its firewall. However, you must set up more protection if you expose your Raspberry Pi to the Internet.
Congratulations! You now have a working home automation hub setup and ready for some automations!