In this article...
Series: Smart RV Tutorial
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!
Parts & Tools
Here are the parts we'll be using today:
- CanaKit Raspberry Pi 3 B+ with Premium Clear Case and 2.5A Power Supply
- SanDisk 32GB High Endurance microSD Card
- Transcend USB 3.0 SDHC / SDXC / microSDHC / SDXC Card Reader
- TP-Link N300 Wireless Portable Travel Nano Router (optional)
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.
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.
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.
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.
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.
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.
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.
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.
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_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.
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:
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:
When it loads, you may see a screen like the following:
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.
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.
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:
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!