We are now going to start the home automation series, where we create a smart home that will allow us to control things like lights, speakers, sensors and so on using a central hub along with a voice assistant. In this post, we will learn how to install Home Assistant on the Raspberry Pi and we will also learn how to view the IP camera stream from the ESP32-CAM board camera we built several posts ago.
The video above shows you how it is all done and it also gives you some more information along the way. I would recommend watching that first, to get a better understanding of how everything comes together.Step 1: Preparing the Raspberry Pi
For this build, we will need to either use the Raspberry Pi 3 or Pi 4. I will be using the Pi 3. You will also need a suitable power source and at least a 32GB microSD card. The first thing we need to do is download a suitable image for our board and that can be obtained using the following link:
Once you have the image, you can use etcher to flash it to your microSD card. Before you can insert it into the Pi and power it ON, you need to decide on the network connection. Home assistant is configured to use a wired connection (ethernet) by default, so if you will be using that then you do not have to do anything further. If you want to use WiFi then you need to create a specific file in the boot drive.
Open up the boot drive (hassio-boot) and create a new folder with the name "CONFIG". Then, open this new folder and create another new folder with the name "network". You can view the image for reference. We then need to create a file in this folder and you can use a text editor like Sublime Text, Notepad++ or Atom to do this. Use the link below and copy the text in the Wireless section as seen in the image. You then need to create a new file and paste these as the contents. Simply add your network name and password without any quotation marks and save the file to the new folder with the name "my-network". Please watch the video to see how this is done.
Once this has been completed, simply insert the microSD card, power ON the Pi and give it a minute to connect to the network and install home assistant.Step 2: Setting Up Home Assistant
The entire installation will take about 20 minutes and this will depend on your network connection as the board needs to download the required files. You can view the status by opening up a browser and typing in hassio.local:8123 which should show you an installation page like in the image.
If this doesn't show up after 1-2 minutes then obtain the board's IP address by using AngryIP scanner and then type in 192.168.1.45:8123 into the web browser, but be sure to use your IP address instead. This should take you to the installation page.
After the installation has completed, you will be asked to create an account and enter some details as part of the onboarding process. You can read more about it using the following link:
Once everything is completed, you will be taken to the home screen and you will be able to start using it right away.Step 3: Adding the $9 ESP32 Based IP Camera
A few posts ago, we made an IP camera using the ESP32-CAM board and we will learn how to add it to home assistant now. You can read more about making the camera by using the link below:
Adding it to home assistant is easy and you can watch the video to see this being done. In summary, you simply need to click the three dots that show up in the top right of the home screen, then click "Configure UI", and confirm that you want to take control of the UI. You will then see a new "add" button on the home screen. Click this and select "Picture". Then, replace the image path with the IP address of the camera, e.g. "http://192.168.1.31". You will then be able to view a preview indicating everything is OK. Simply save this and the camera feed will show up on the home screen. You can also use AngryIP scanner to obtain the IP address of the ESP32-CAM board.
And that is how easy it is to get home assistant up and running using the Raspberry Pi. We will continue adding more devices to home assistant and these videos/posts will be released on Tuesdays. Please do consider subscribing to our YouTube channel as that helps support us.
Thank you for reading!