Home Assistant – Beginner’s guide Based on HassOS

The Developers of Home Assistant have released a new updated version for Hass.io which is now based on their own operating system called HassOS instead of using the ResinOS. Today, I’m going to show you how to install Hass.io in my Raspberry Pi 3. I’m going to show you how to set up the WiFi connection, the Configurator and the Samba add-on so you can access the Home Assistant configuration files and, last, we’ll set up the DuckDNS add-on so you can access the home assistant remotely.

 

Step 1 – Download the latest of Hass.IO

Download the latest version of Hass.io from the Home Assistant website. There is a 32bit and a 64bit version for the Raspberry Pi 3. They recommend to download the 32bit version but, let’s download the 64bit. Use an app like WinRAR to extract the image. Then, insert the SD card into the computer, and use Etcher to copy the image to the SD card.

Etcher
After you open Etcher, click on Select Image, and search and select the Hass.io image. Make sure that Etcher picked the correct drive to install the image, otherwise click on Change and choose the SD card. Lastly, click on Flash and give it a few minutes for the process to complete.

 

Step 2 – Set up WFi connection

All right so the SD card is ready. Now if you’re connecting the Pi via Wifi, you would need to set up a flash drive (not the SD card with the Hass.io image) that would have a file with the WiFi settings. Let me show you how to do that.
After you connect a flash drive to your computer, you would need to format it. So, right click on the drive and click on Format. Then, under the Volume label enter the name CONFIG. Click on Start then, OK to format the drive.

Formate Flash Drive
When finished, open the drive, create a new folder named network then inside that folder, create a file named system-connections. Now, open the file and enter the following information.

[connection]
id=hassos-network
uuid=YOUR_UUID_NUMBER
type=802-11-wireless

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

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

[ipv4]
method=auto

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

 

Enter your WiFi name under SSID and the WiFi password under psk. For the UUID you can generate a new number by going to uuidgenerator.net. Save the file and unmounted from the computer.

UUID Page
All right so you now have the new Hass.io image in the SD card, and you set up the WiFi settings in a Flash drive. Now you can insert them in the Raspberry Pi and boot the Pi. Once the Pi connects to the WiFi, and Hass.IO starts, it will download and install the latest version of Home Assistant.

 

After like a minute or 2, open your browser and go to hassio.local:8123. If the Pi connected successfully to your WiFi, you would get the Home Assistant Preparing page. Give it a few minutes, for the latest version of Home Assistant to install.

Home Assistant Preparing page

UPDATE: When Home Assistant starts for the first time, it reads the CONFIG flash drive and saves the WiFi configuration. So, after Home Assistant is up and running, you can remove the flash drive from the Raspberry Pi.

 

Step 3 – Set up the Configurator or Samba

All right so Home Assistant is now up and running. Now, you need to set up the Configurator add-on or the Samba add-on so you can access the Home Assistant configuration files. I’m going to show you how to set up both of them, but you can decide which one you like better and install just one of them or be like me and have them both installed.

 

Configurator add-on set up

On the left side of Home Assistant, click on Hass.io. Then go to Add-on Store and select Configurator. Click on Install and give it a couple of minutes. After the installation is done, set up a username and a password so you can protect access to the Home Assistant configuration files. Make sure that the username and password are within quotes (“ ”).

{
  "username": "YOUR_USERNAME",
  "password": "YOUR_PASSWORD",
  "certfile": "fullchain.pem",
  "keyfile": "privkey.pem",
  "ssl": false,
  "allowed_networks": [
    "192.168.0.0/16",
    "172.30.0.0/16"
  ],
  "banned_ips": [
    "8.8.8.8"
  ],
  "banlimit": 0,
  "ignore_pattern": [
    "__pycache__"
  ],
  "dirsfirst": false,
  "enforce_basepath": false
}

Click on Save and then Start the add-on. Now to access the Configurator, click on OPEN WEB UI. Another tab opens where you would need to sign in using the username and password that you created.

Configurator page

 

All right so you now have access to the Home Assistant configuration files. If you click on the Folder icon to the left, you can see all the other available files.
Before we move on to install the Samba add-on, set up a password for the Home Assistant web interface so like that it’s not wide open especially that we’re going to set up remote access.
Under HTTP, we have the line # api_password. Remove the hash “#” at the beginning to activate the line, then type a new password and when finished, click on the Save icon at the top.
Now you need to restart Home Assistant so the changes take effect and you can do that here directly from the configurator. Click on the Menu icon on the top right and then click on Restart Hass.

Restart HASS
Go back to the Home Assistant page and after like a minute or two refresh the page and you would now need to enter the new password created.
Ok, so the Configurator is all set. Now let’s go ahead and install the Samba add-on.

 

Samba add-on set up

On the left side of Home Assistant go to Hass.io, then Add-on store, select the Samba share add-on and then click on Install. Now, under Config, set up the following.

{
  "workgroup": "WORKGROUP",
  "name": "hassio",
  "guest": false,
  "map": {
    "config": true,
    "addons": true,
    "ssl": false,
    "share": true,
    "backup": true
  },
  "username": "YOUR_USERNAME",
  "password": "YOUR_PASSWORD",
  "interface": "wlan0",
  "allow_hosts": [
    "10.0.0.0/8",
    "172.16.0.0/12",
    "192.168.0.0/16"
  ]
}

If you set up a specific WorkGroup name on your computer, you can change it here, otherwise, leave it with the default name (WORKGROUP). Guest mode, change it from true to false. So no one can access the configuration files without a login. Under map, we have 5 different folders that you can select to see in the shared folder. If you want to disable one of them, you can change it from true to false. Set up a username and password, so the Shared folder is secure. Remember to enclose them within quotes (“ ”). Now for the interface, if you have your Raspberry Pi connected with an Ethernet cable, set it to eth0. If you are connected via WiFi, then set it to wlan0. Now, click on Save and then Start to enable the Samba add-on. Check the Log below to make sure that everything went well.

 

Now, open the File Explorer, then go to Network and the HASSIO shared folder should now be available. If it doesn’t come up right away, refresh the page and give it a second. When you open the shared folder for the first time, you would need to sign in using the username and password that you created. You can click on Remember my credentials, so you don’t have to sign in everytime you want to access the configuration files.

Samba login
All right so we now have access to the Home Assistant configuration files, and we can use any text editor that we would like for example Notepad++ or Atom which is the one I preferred.

 

Step 4 – Set up the DuckDNS add-on

Next, we are going to install the DuckDNS add-on so we can have a secured connection to Home Assistant from outside the home network.
Go to Hass.io, select Add-on Store and then click on Duck DNS. Now, click on Install and give it a couple of minutes for the add-on to install. Once the installation finish, go to duckdns.org and sign in using one of the available methods to create a new account. Create a new subdomain name and then copy the new DuckDNS token.

DuckDNS page 2

 

Go back to Home Assistant, and under Config, change the Accept terms to true. Then under Token, enter the new DuckDNS token number and, under Domains, enter the new domain name created in the DuckDNS website. Make sure that the token number and the domain name are enclosed within quotes.

{
  "lets_encrypt": {
    "accept_terms": true,
    "certfile": "fullchain.pem",
    "keyfile": "privkey.pem"
  },
  "token": "YOUR_DUCKDNS_TOKEN",
  "domains": [
    "YOUR_DOMAIN.duckdns.org"
  ],
  "seconds": 300
}

Now, click on Save and before starting the add-on, you need to access the router settings. There are 2 things that you need to set up in your router. One, you need to make sure that your Raspberry Pi is set up to always get the same IP address from the network and two you need to create a port forwarding rule for Home Assistant. All router settings are a little bit different so, I wouldn’t be able to tell you exactly where to go to set these things up but for you to have an idea, I’m going to show you how to set up the port forwarding rule in an ASUS router.
Name the new port forwarding rule Hassio_SSL, set the Port Range to 443, for the local IP, set it to the Raspberry Pi’s IP address, the Local Port set it to 8123, and you can leave the Protocol set to TCP. Click on the Plus (+) icon to add the new rule, then click on Apply and reboot the router. Once the router is back online, go back to Home Assistant and Start the Duck DNS add-on. Check the Log below to make sure that the set up was successful.

Hassio_SSL update

 

Next, you need to add the DuckDNS URL that was created and also the SSL information in the configuration.yaml file. So, open the Configurator add-on to access the configuration.yaml file. Under HTTP and below the api_password enter the following and only change the base_url to your DuckDNS URL.

http:
  api_password: YOUR_PASSWORD
  base_url: your_domain.duckdns.org
  ssl_certificate: /ssl/fullchain.pem
  ssl_key: /ssl/privkey.pem

Click on Save and then restart Home Assistant.
Now, to access the Home Assistant web interface from inside and outside your home network, you would now need to use the DuckDNS URL.

 

Step 5 – Fix access to the Configurator page

Now, because we set up the SSL connection, we now need to fix the access to the Configurator. If we try to access the Configurator page, you get an error message saying that the page can’t be reached. So, to correct that under the Configurator Config, change the SSL from false to true and then click on Save. You also need to set up a port forwarding rule. So, access your router settings and create a new rule named Hassio_Configurator. Set the Port Range to 3218, for the local IP, set it to the Raspberry Pi’s IP address, the Local Port set it to 3218, and you can leave the Protocol set to TCP. Click on the Plus (+) icon to add the new rule, then click on Apply and reboot the router.

Hassio_SSL and Configurator update

 

After the router is back online, go back to Home Assistant and restart the Configurator add-on. Then try to access the Configurator, and you would now be able to sign back in and have access to the Home Assistant configuration files.

 

WANT TO SUPPORT JUANMTECH?

You can do so now on Patreon and Buy Me A Coffee

Leave a Reply