Home Assistant: Setup Guide

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.

  1. Raspberry Pi 3 B+.
  2. Micro SD card. Preferably a Class 10 card with more than 32GB of memory.
  3. SD card reader.
  4. An Ethernet cable (for a wired connection)
  5. A USB stick (for a Wi-Fi connection)
  6. A monitor & HDMI cable (not required but useful for debugging)
  7. A keyboard (also useful for debugging)

Home Assistant Setup: Part 1 - Parts List.

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.

  1. Insert the SD card in to the card reader and connect it to your computer.
  2. Backup your files!
  3. Open Etcher
  4. Select the hassos_rpi3 img file.
  5. Select the SD card.
  6. Hit Flash!
  7. Have a coffee
  8. Verify Etcher has successfully flashed the SD card.
  9. Proceed to Step 3.

Home Assistant Setup: Part 1 - Etcher 1

1. Select Hassio Image & SD Card.

Home Assistant Setup: Part 1 - Etcher 2

2. Hit Flash

Home Assistant Setup: Part 1 - Etcher 3

3. Wait...

Home Assistant Setup: Part 1 - Etcher 4

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)

  1. Connect one end of the Ethernet cable to your Wi-Fi routers LAN port.
  2. Connect the other end of the Ethernet cable to your Raspberry Pi's Ethernet port.
  3. 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.

  1. Plug your USB in to the computer.
  2. Copy any important files stored on the USB stick to the desktop.
  3. Format the USB to FAT32 and give it the CONFIG.
  4. Home Assistant Setup: Part 1 - Formatting

  5. Create a folder named ‘network’ within CONFIG and open the folder.
  6. Right click and create a new Text Document named ‘my-network’.
  7. Open the ‘my-network’ text file.
  8. Copy and paste the Wireless WPA/PSK template code (also shown below) in to the ‘my-network’ document.
  9. [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
    
    

    Home Assistant Setup: Part 1 - Wi-Fi

  10. If you want your IP address to remain the same each boot (recommended), use UUID4 to generate a unique identifier.
  11. Home Assistant Setup: Part 1 - UUID

  12. Change 72111c67-4a5d-4d5c-925e-f8ee26efb3c3 to the new UUID4 value.
  13. Change MY_SSID to your network name.
  14. Change MY_WLAN_SECRET_KEY to your network password.
  15. Save the ‘my-network’ document.
  16. Close the ‘my-network’ document.
  17. Enable file extensions by clicking the 'View' tab and selecting 'File Name Extensions'
  18. Home Assistant Setup: Part 1 - Text 2

    Home Assistant Setup: Part 1 - Text 1

  19. Delete the .txt extension from the my-network file.
  20. Home Assistant Setup: Part 1 - Text 3

    Home Assistant Setup: Part 1 - Text 4

  21. Eject the USB.
  22. Proceed to Step 4.

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:

  1. Set up your Raspberry Pi on a desk.
  2. Insert your micro SD card into the Raspberry Pi's micro SD card reader. (refer Step 2)
  3. Ensure you have connected your Ethernet cable or inserted your USB drive into your Raspberry Pi (refer Step 3)
  4. Connect your Raspberry Pi to power.
  5. Wait 20 or so minutes for HassOS to download and install. Treat yourself to another coffee? :)
  6. Be sure to check you have a compatible web browser installed. If you don’t, we recommend Google Chrome.
  7. Open your web browser and enter http://hassio.local:8123 in to the address bar.
  8. If the link in 7. results in the following error message being displayed on screen, follow the below section to troubleshoot.

Home Assistant Setup: Part 1 - Fail

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.

  1. Ensure you are using a compatible web browser
  2. Clear your browser cache.
  3. 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:

  1. Download the network tools app Fing on to your phone.
  2. Open Fing.
  3. Find the device called Hassio.
  4. 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/)
  5. 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:

  1. A monitor.
  2. A HDMI cable.
  3. A keyboard.

And this procedure:

  1. Power on the Raspberry Pi (if it isn’t running already).
  2. Connect the Pi to a monitor.
  3. Connect the Pi to a keyboard.
  4. 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'
  5. You’ll see the line 'Welcome to HassOS' followed by the line 'hassio login:'
  6. Enter 'root' to login (no password needed).
  7. You’ll then be prompted by 'hassio >' where you can type 'login' and press enter to enter configuration mode.
  8. Confirm you’re in configuration mode by the prompt '#'
  9. Type nmcli and press enter.
  10. Cite the line inet4 which contains your Raspberry Pi’s IP address.
  11. Go to your computer and open your web browser.
  12. 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.

Home Assistant Setup: Part 1 - Welcome

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.

Home Assistant Setup: Part 1 - Dashboard

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..

  1. Insert the SD card into a digital camera.
  2. Navigate to the 'format SD card' option.
  3. Format the SD card.
  4. 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 :)

Best regards,

Luke

Related blogs

Home Assistant: Z-Wave Guide
What is Z-Wave Plus?