Smart RV Tutorial - Part 2: Installing Home Assistant on a Raspberry Pi

Thu May 06 2021

Home Assistant will be the brains of our entire Smart RV, so in this blog post we'll be installing it on a Raspberry Pi connected to WiFi, ready to start adding devices.

Smart RV Tutorial - Part 2: Installing Home Assistant on a Raspberry Pi
As an Amazon Associate we earn from qualifying purchases.

Introduction

In Part 1 of this tutorial, we set ourselves the goal of building the ultimate DIY Smart RV based around Home Assistant, so it should come as no surprise that the first step is to set up Home Assistant itself!

In that part, we looked at the various options for hardware that you can use to run Home Assistant - anything from a low-powered Raspberry Pi up to a full computer.

In this tutorial we're going to be using a Raspberry Pi 3 Model B+ as the basis of our system, so that's what we'll be installing Home Assistant on today. If you chose a Raspberry Pi 4 then the process is very similar, but if you went with something totally different then you might want to check out the Installation section of the Home Assistant documentation - and actually, that's a great resource regardless of the route you chose!

CanaKit Raspberry Pi 3 Model B+
I'll be using this CanaKit Raspberry Pi 3 Model B+ kit for this tutorial series, but the instructions are similar regardless of what hardware you choose to use.

Parts & Tools

Here are the parts we'll be using today:

You don't have to use a Raspberry Pi kit, but for simplicity it's what I've chosen to use in this tutorial. If you don't, you'll need to make sure you find a good power adapter and I'd recommend an enclosure to keep it protected.

CanaKit Raspberry Pi 3 Contents
Inside the kit you'll find a case, power adapter, Raspberry Pi with heat sinks, and a convenient micro-USB power switch.

There are multiple options for microSD card readers, and you may even find that your computer has an SD card slot that you can use with the adapter that came with your microSD card. The Transcend one listed above is the one I happen to own - I bought it 6 years ago and it's still working great.

Micro SD Card Readers
There are multiple types of micro SD card reader, but my usual go-to is the Transcend shown at the top of this picture.

As for the TP-Link N300 travel router, we'll talk more about that later on.

Setting Up the Raspberry Pi

If this is your first time working with a Raspberry Pi, you might be a bit intimated - it looks like a scary circuit board and you're not sure what to do. Well, don't worry, I'll guide you through.

Raspberry Pi 3 Kit
Inside the kit you'll find all the parts you need to assemble the Raspberry Pi - don't be intimidated, it's very easy to get started.

The kit comes with a Quick Start guide, but it's designed to get you up and running with the Raspbian operating system as though you were going to use it as a regular desktop.

Instead of following all these steps, you only need to follow steps 1 and 2 - assemble the circuit board inside the case, and attach the heat sinks on the Broadcom CPU and Ethernet / USB Controller. Don't worry about steps 3-9 - they don't apply to us.

Raspberry Pi 3 Assembled
When it's fully assembled (minus the top cover for clarity) it should look like this.

Don't connect it to power or install the microSD card just yet - we need to put the Home Assistant installer on it first!

Setting Up WiFi

Home Assistant runs on your local network, which means that although it doesn't need internet connectivity to operate, it does need a local WiFi network. If you're a full-time RVer then there's a good chance you've already got a WiFi network running in your RV, like we do.

How we get Internet in our RV

Whether you just want to check emails and social media, stream movies or work from the road, reliable internet connectivity in your RV has never been more important. Here's how we do it!

How we get Internet in our RV

But if not, you'll need to set one up. This is where I'd recommend the inexpensive micro-USB powered TP-Link N300 travel router.

TP-Link N300 Travel Router
I've had one of these for years - it's great not just for RVs but also for staying in hotels.

I first bought one years ago when I was traveling for business several times a month and staying in hotels. I would have a couple of laptops, phone, iPad, Kindle and several other WiFi-connected devices - not only was it a pain to connect each one to the hotel's WiFi, but several of them (e.g. my Kindle) didn't work well with the captive portals that many hotels were using.

The travel router allows you to create your own WiFi network wherever you are, then bridge it to either another WiFi network (e.g. the hotel WiFi) or even a wired Ethernet connection. In our situation, you can use one of these in your RV without ever connecting it to the internet, or you can bridge it to the campground WiFi or even your phone using its tethering feature to give all your devices internet access.

Setting up the travel router is outside the scope of this blog post, but if you decide to go down this route it's pretty straightforward if you just follow the instructions that it comes with. If you do choose this route and you're not using the Ethernet connection for anything else, you can plug your Raspberry Pi in to the Ethernet port and skip the section below about configuring WiFi on the Raspberry Pi.

Installing Home Assistant

There are several supported ways (and a few more unsupported ways) to install Home Assistant, but for this tutorial series we're going to be keeping things simple - we're going to be using the Home Assistant Operating System method.

Flashing the microSD Card

The Home Assistant documentation does a great job of explaining how to install the latest version of Home Assistant onto your microSD card using some software called Balena Etcher.

This is the way I'd recommend, so follow the instructions there to download Home Assistant and flash it onto your microSD card using Balena Etcher, but stop before you insert it into your Raspberry Pi.

Make sure to select the correct download URL for the Home Assistant software. If you're using a Raspberry Pi 3 Model B+ like me, you'll want to download the Raspberry Pi 3 64-bit software.

Configuring WiFi

Before we boot up the Raspberry Pi, there's one little tweak we need to make. The Home Assistant instructions assume you're going to be using a wired Ethernet connection for your Raspberry Pi, but in our case we'll be using WiFi. We need to tell Home Assistant our WiFi credentials (the network name, known as the SSID, and our password).

I wasn't able to get this next step to work correctly on MacOS so you'll need to use a Windows machine for this.

After flashing the microSD card with Balena Etcher, it typically ejects the card so you'll need to physically unplug it from your computer and plug it back in again. If you're prompted to format the drive, click Cancel.

Open Windows Explorer and you should see a drive called hassos-boot. Create a folder in here named CONFIG and then browse into it. Inside here, create another folder named network and again, browse into that folder. Last, create a file called my-smart-rv - make sure it doesn't have the .txt extension at the end.

Edit the my-smart-rv file so that it contains the following contents:

[connection]
id=my-smart-rv
uuid=<UUID>
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid=<WIFI_SSID>
# uncomment the line below by removing the # if your WiFi is hidden
#hidden=true

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk=<WIFI_PASSWORD>

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

Each of the items in angle brackets above needs to be replaced with a real value.

You'll need to generate a random UUID to insert in place of the <UUID>, and replace <WIFI_SSID> and <WIFI_PASSWORD> with your own, for instance:

[connection]
id=my-smart-rv
uuid=c701caf5-ccd2-4902-bf55-ac36d19ffd10
type=802-11-wireless

[802-11-wireless]
mode=infrastructure
ssid=MySmartRV

[802-11-wireless-security]
auth-alg=open
key-mgmt=wpa-psk
psk=myverysecurepassword

[ipv4]
method=auto

[ipv6]
addr-gen-mode=stable-privacy
method=auto

Again, double check that it doesn't have the .txt extension on the file. Once you're done with this, you can eject the microSD card and insert it into your Raspberry Pi.

First Boot

After you insert the microSD card into the Raspberry Pi, connect it to power and it will begin booting. It may take a few minutes on the first boot to get up and running, but once it's booted you should be able to access it by going to the following URL in your browser:

http://homeassistant.local:8123/

If for any reason that doesn't work, you'll need to retrieve the IP address of your Raspberry Pi from your router, and use that instead, for example:

http://192.168.1.5:8123/

When it loads, you may see a screen like the following:

Home Assistant Booting
Home Assistant is setting up and on a low-power device like the Raspberry Pi 3, this may take up to 20 minutes or so.

Per the instructions, give it some more time (up to about 20 minutes) and then check back. During this time the Raspberry Pi will be downloading some data so you'll need to be connected to the internet for this step. The Raspberry Pi may reboot a few times during this process but eventually you should see the following screen appear.

Home Assistant User Accounts
This will be your main user account so make it secure - you can add more accounts for other people later.

Creating an Account

The next step is pretty obvious - we need to create an account. I suggest using a secure password for this since if someone guesses your password they'll have control over everything in your automation system!

Fill in your name, username and password, then click Create Account.

On the next screen, you'll be prompted for a few details about your smart home - a name for it, its location, timezone and your unit preference. For now, pick a sensible location but later on we'll look at how to update this dynamically when your RV is on the move!

Next, you'll be asked if you want to share any diagnostic information with Home Assistant. This is entirely up to you, but the data is used by the developers to focus their efforts where the community needs it most.

Home Assistant Discovery
My new Home Assistant installation found lots of things it could add, but I didn't add any of them for now. If you have any items here then feel free to add them to automatically get them set up and running.

Last, Home Assistant will attempt to detect any devices on your network that it can automatically set up. Since we already have a lot of devices on our network, it found lots of things but don't worry if you don't have any.

Click Finish and you're done! You should see a screen like below:

Home Assistant Dashboard
This is known as Lovelace, the dashboard in Home Assistant. It looks a little empty right now but before long it'll include everything in our Smart RV.

Summary

That's it - you now have Home Assistant up and running on your Raspberry Pi. In the next article in this tutorial, we'll look at how we integrate our first device - a smart plug.

I hope you enjoyed this blog post and I look forward to building the ultimate DIY smart RV with you!

Learn More

Finally, make sure to check out these videos on YouTube, and don’t forget to subscribe to our channel to be notified when we publish new videos!

YouTube Video Player
Outdoors RV Factory Tour Part 2 (RV wall construction)
YouTube Video Player
Outdoors RV Factory Tour Part 3 (Quality Control + Anniversary Series)
Previous post13 Must Have RV AccessoriesNext postGAFFL: RV Travel