Home Assistant: Setup Guide
So you’ve decided you want to get started in the world of home automation and are faced with the following choice…
Will the heart of your system be a powerful, plug-and-play controller that works out of the box such as the Fibaro Home Centre 2?
Or will it come to life with the people focused, open-source/highly-customisable home automation platform Home Assistant?
If you enjoy a hands on experience and desire ultimate control over your system, Home Assistant may be the platform you’re searching for. With a growing community, emphasis on privacy and an extensive array of plugins, you’ll be sure to find everything needed to suit your needs. Home Assistant really is a tinkerers dream.
Intrigued? Here’s a short word from it’s creator.
The purpose of this blog is to guide you through the process of setting up your own Home Assistant Hub, from acquiring the parts to landing on your Home Assistant Dashboard for the first time. I've kept each step as simple as possible and included reference images alongside other useful information.
Before proceeding, it's important to mention that even with extensive online resources and documentation, the Home Assistant route is still not a journey for the faint-hearted. While setting up Home Assistant is simple, a level of understanding about computers, networks and programming is needed in order to configure Home Assistant to meet your needs.
Prerequisites: Technical know-how and dedication to learning the Home Assistant platform are prerequisites to getting the most out of your Home Assistant, and needed to overcome any 'gotchas' that may arise.
If you feel you’re up for the challenge, awesome! Let’s get started.
Step 1: Gather the Parts
Begin by acquiring the parts listed below. If you don’t have them handy, you can get everything you need online. A quick shop around and you'll find the necessities for around $120.
- Raspberry Pi 3 B+.
- Micro SD card. Preferably a Class 10 card with more than 32GB of memory.
- SD card reader.
- An Ethernet cable (for a wired connection)
- A USB stick (for a Wi-Fi connection)
- A monitor & HDMI cable (not required but useful for debugging)
- A keyboard (also useful for debugging)
You’ll also need to download and install Etcher and download the Hass.io zip file for the Raspberry Pi 3 B+. Etcher is a tool used to ‘flash’ the SD card, while the Hass.io file contains HassOS, the most powerful Home Assistant Operating System used to turn your Pi into a Home Assistant Hub.
Etcher? Flashing an SD card?? Operating System (OS)? What’s all this mean? Basically, every computer has a brain, comprised of a chip and an OS. The OS determines how the computer will function, while the chip simply stores the OS. Change the OS and you change the function of the computer. We can use Etcher to do just that in a process called ‘flashing’, which wipes the chip clean and installs the desired OS.
Step 2: Flashing the SD card with the Home Assistant OS.
The Raspberry Pi is now ready to begin its transformation from a mini computer (running the Raspbian OS) to a fully-fledged Home Assistant Hub running the HassOS - the Home Assistant Operation System. All we need to do to help it along is ‘flash’ the HassOS image to our SD card (the Pi’s brain).
Caution: Be aware that the SD card will be completely wiped during this process.To prevent loss of data, be sure to copy any files you want to keep on to your computer before continuing or they will be lost forever.
- Insert the SD card in to the card reader and connect it to your computer.
- Backup your files!
- Open Etcher
- Select the hassos_rpi3 img file.
- Select the SD card.
- Hit Flash!
- Have a coffee
- Verify Etcher has successfully flashed the SD card.
- Proceed to Step 3.
1. Select Hassio Image & SD Card.
2. Hit Flash
4. Completion -> Proceed to Step 3.
Step 3: Configuring Home Assistant's Internet Connection
Home Assistant supports both wired and wireless connections to your home network. For improved stability and a simpler set-up, we recommend connecting your Pi to your home router via an Ethernet cable. However if you’d like to use Wi-Fi that’s OK too. You’ll just have to setup your Pi with the credentials needed to connect to your Wi-Fi network.
Depending on your preference, use either the Wired Setup Procedure or the Wi-Fi Setup Procedure to set-up the Wi-Fi credentials:
Wired Setup Procedure (recommended)
- Connect one end of the Ethernet cable to your Wi-Fi routers LAN port.
- Connect the other end of the Ethernet cable to your Raspberry Pi's Ethernet port.
- Proceed to Step 4.
Wi-Fi Setup Procedure
Caution: This step involves formatting your USB stick, which will erase everything stored on it. Be sure to back up any important files up or they will be lost forever.
- Plug your USB in to the computer.
- Copy any important files stored on the USB stick to the desktop.
- Format the USB to FAT32 and give it the CONFIG.
- Create a folder named ‘network’ within CONFIG and open the folder.
- Right click and create a new Text Document named ‘my-network’.
- Open the ‘my-network’ text file.
- Copy and paste the Wireless WPA/PSK template code (also shown below) in to the ‘my-network’ document.
- If you want your IP address to remain the same each boot (recommended), use UUID4 to generate a unique identifier.
- Change 72111c67-4a5d-4d5c-925e-f8ee26efb3c3 to the new UUID4 value.
- Change MY_SSID to your network name.
- Change MY_WLAN_SECRET_KEY to your network password.
- Save the ‘my-network’ document.
- Close the ‘my-network’ document.
- Enable file extensions by clicking the 'View' tab and selecting 'File Name Extensions'
- Delete the .txt extension from the my-network file.
- Eject the USB.
- Proceed to Step 4.
[connection] id=hassos-network uuid=72111c67-4a5d-4d5c-925e-f8ee26efb3c3 type=802-11-wireless [802-11-wireless] mode=infrastructure ssid=MY_SSID # Uncomment below if your SSID is not broadcasted #hidden=true [802-11-wireless-security] auth-alg=open key-mgmt=wpa-psk psk=MY_WLAN_SECRET_KEY [ipv4] method=auto [ipv6] addr-gen-mode=stable-privacy method=auto
With the Ethernet cable connected or the text file configured with the Wi-Fi credentials, proceed to Step 4
Step 4: From Raspberry Pi to Home Assistant Hub
Armed with your SD card, now flashed with HassOS (and potentially a USB with your Wi-Fi credentials), your Raspberry Pi is ready to undergo its transformation into a Home Assistant Automation Hub.
Note: Once the HassOS is installed, your Raspberry Pi will be operating as a Home Automation Hub and not function like a traditional computer. This is an important distinction to make as traditional computers are connected to monitors, whereas Hubs are typically accessed through a compatible web-browser.
To begin the Pi’s transformation:
- Set up your Raspberry Pi on a desk.
- Insert your micro SD card into the Raspberry Pi's micro SD card reader. (refer Step 2)
- Ensure you have connected your Ethernet cable or inserted your USB drive into your Raspberry Pi (refer Step 3)
- Connect your Raspberry Pi to power.
- Wait 20 or so minutes for HassOS to download and install. Treat yourself to another coffee? :)
- Be sure to check you have a compatible web browser installed. If you don’t, we recommend Google Chrome.
- Open your web browser and enter http://hassio.local:8123 in to the address bar.
- If the link in 7. results in the following error message being displayed on screen, follow the below section to troubleshoot.
If http://hassio.local:8123/ fails to connect:
The most difficult problem I faced while setting up Home Assistant was failure to connect to the Hub by entering hassio.local:8123 in to my computer's web-browser. I tried on different computers running different browsers to no avail, before discovering a few potential causes for the issue. If you find yourself in this situation, try the following simple workarounds first to rule out the easiest potential causes first.
- Ensure you are using a compatible web browser
- Clear your browser cache.
- Try and connect to http://hassio.local:8123/ in incognito mode.
If you are still facing any connection issues, it is likely that your router is not configured to support mDNS. The simplest workaround is to find the IP address of your Home Assistant Hub and directly connect to that IP address through your browser by searching your IP address in the format http://XXX.XXX.XXX.XXX:8123. Our first step though is to find Hassio's IP address, which can be achieved in one of two ways:.
For Wi-Fi users: If you do not change the UUID and allow configure your IP address to remain automatic, (seen by the line [ipv4]method=auto) your Pi will be assigned a new IP address each time it reboots. The implication is that you will need to repeat this procedure to find the new IP address after each reboot. To prevent this inconvenience, ensure you configure the UUID as per Step 3.
Option 1: Find the IP using Fing (Easy).
The easiest way to find the IP address of a device connected to your Wi-Fi network is to use Fing. It's quick and easy to use, and only requires you to:
- Download the network tools app Fing on to your phone.
- Open Fing.
- Find the device called Hassio.
- Enter the IP address for Hassio in to your browser in the following format: http://XXX.XXX.XXX.XXX:8123/. (e.g http://192.168.1.111:8123/)
- You should see Home Assistant Home Screen.
Option 2: Using Home Assistant's Command Line Interface (Advanced).
This option is more complicated and requires you connect a monitor and keyboard to the Raspberry Pi for local access. You can then input a set of commands directly into Home Assistant's command line interface to return the IP address. I recommend you only use this procedure if you cannot use Fing to find your IP address, but if you have no other choice, don’t let all the the code intimidate you. It’s a relatively simple procedure to get the Pi to return it’s IP address.
You’ll need the following things:
- A monitor.
- A HDMI cable.
- A keyboard.
And this procedure:
- Power on the Raspberry Pi (if it isn’t running already).
- Connect the Pi to a monitor.
- Connect the Pi to a keyboard.
- Wait for the Pi to boot up. You can confirm the boot procedure is complete by citing the line of code: 'starting eudev-3.2.7'
- You’ll see the line 'Welcome to HassOS' followed by the line 'hassio login:'
- Enter 'root' to login (no password needed).
- You’ll then be prompted by 'hassio >' where you can type 'login' and press enter to enter configuration mode.
- Confirm you’re in configuration mode by the prompt '#'
- Type nmcli and press enter.
- Cite the line inet4 which contains your Raspberry Pi’s IP address.
- Go to your computer and open your web browser.
- Enter your ip address in the format http://192.168.XXX.XXX:8123/ into your browser's address bar.
Step 5: Welcome to Home Assistant
Once your web browser has successfully connected to your Home Assistant Hub, you’ll land on the create account page. Simply enter your desired account details then hit the 'Create Account' button.
Keep those Credentials Safe! Be sure to keep a copy of your account somewhere safe as you'll need them to gain access to your Home Assistant Hub from now on.
With your account created, you’ll land on your Home Assistant Dashboard. This is where the real fun begins and where this post concludes. Congratulations on making it this far. Stay tuned for Part 2: Configuring Home Assistant.
Gotchas - Troubleshooting & Debugging
Gotchas are tricky little areas where the result you achieve is not as you expect. I stumbled across a few during my first experience setting up Home Assistant. I followed the official installation guide however I was left a little unsure as to whether my experience was normal. The following section presents an explanation to them.
Windows does not recognise an SD card once it is flashed by Etcher.
Windows only supports certain SD card formats, including Fat32, EXFAT and NTFS. After ‘flashing’ the Home Assistant OS on to the micro SD card, it becomes a format not recognised by Windows. If you insert the micro SD card into the computer as normal, it will not show up as expected.
DO NOT WORRY!
Insert the micro SD card into the Pi however and you’ll see the card is working correctly. It’s worth mentioning that Etcher will still see the micro SD card when it’s connected to the computer, and you can flash a different image file on to it.
If you’d like to return your SD card to standard format and cannot use a computer to do so, you can always try reformatting it using a digital camera. Here's the procedure:
Note: As with all formatting procedures, the SD card is completely wiped. This will remove the file ‘flashed’ on to the card previously..
- Insert the SD card into a digital camera.
- Navigate to the 'format SD card' option.
- Format the SD card.
- Next time you connect it to a computer, it will appear as normal.
That's a Wrap
I hope this guide has helped you set-up your Home Assistant hub. In Part 2 you'll learn how to set-up your automation network and configure your first automation. In the mean time, have a look around and get to know Home Assistant. It's a cool platform to work with. As always, if you have any questions or thoughts, drop a comment below :)