1. Install Raspberry Pi Operating System 64-bit

Run the Raspberry Pi Imager, available from here: https://www.raspberrypi.com/software/

Select your device - e.g. Raspberry Pi 5

Select the following options:

  • Name: homeassistant.local
  • Admin Username: myadmin
  • Admin Password: *****
  • WiFi SSID: MyWifiNetwork
  • WiFi Password: *****
  • Services - Enable ssh
  • Services - Password authentication

Choose your storage, and write


2. Log in, Configure and Install Required Applications

2.1 From a unix command line, use the ssh command to log into the newly booted Pi

$ ssh -l myadmin homeassistant.local

The authenticity of host 'homeassistant.local' can't be established.
Are you sure you want to continue connecting?
yes
Warning: Permanently added 'homeassistant.local' to the list of known hosts.
myadmin@homeassistant.local's password:
*****

myadmin@homeassistant:~ $


2.2 Ensure that the installation files are up-to-date

sudo apt-get update

Hit:1 http://deb.debian.org/debian bookworm InRelease
Get:2 http://deb.debian.org/debian-security bookworm-security InRelease [48.0 kB]
Get:3 http://archive.raspberrypi.com/debian bookworm InRelease [54.8 kB]
Get:4 http://deb.debian.org/debian bookworm-updates InRelease [55.4 kB]
Get:5 http://deb.debian.org/debian-security bookworm-security/main arm64 Packages [254 kB]
Get:6 http://archive.raspberrypi.com/debian bookworm/main arm64 Packages [537 kB]
Get:7 http://deb.debian.org/debian-security bookworm-security/main armhf Packages [240 kB]
Get:8 http://archive.raspberrypi.com/debian bookworm/main armhf Packages [539 kB]        
Fetched 1,624 kB in 1s (1,422 kB/s)                       
Reading package lists... Done


2.3 Identify the latest versions of what we will be downloading

Visit https://github.com/home-assistant/os-agent/releases and identify the latest version file. Note that the Pi5 on 64-bit raspbian requires the aarch64 file.


2.4 Install some of the libraries we are going to need

sudo apt-get install apparmor jq wget curl udisks2 libglib2.0-bin network-manager dbus systemd-journal-remote systemd-resolved libffi-dev libssl-dev python3-dev python3 python3-pip nginx certbot python3-certbot-nginx -y  
Reading package lists... Done
Building dependency tree... Done
Reading state information...
...

$ sync; sudo reboot

 

2.5 Install Docker Components (docker-ce)


Docker (or at least parts of docker) is required by the home assistant in supervised mode because it is used by addons (each addon runs in a separate container).
Without this step, the homeassistant-supervised.deb install in step 2.7 will complain that docker-ce is missing.

$ curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh 

================================================================================

To run Docker as a non-privileged user, consider setting up the
Docker daemon in rootless mode for your user:

   dockerd-rootless-setuptool.sh install

Visit https://docs.docker.com/go/rootless/ to learn about rootless mode.


To run the Docker daemon as a fully privileged service, but granting non-root
users access, refer to https://docs.docker.com/go/daemon-access/

WARNING: Access to the remote API on a privileged Docker daemon is equivalent
        to root access on the host. Refer to the 'Docker daemon attack surface'
        documentation for details: https://docs.docker.com/go/attack-surface/

================================================================================
2.6 Download the latest Home Assistant Operating System Agent

Using the up-to-date link as identified in 2.3 (above), fetch and install the os-agent.
The os-agent is required by the supervised release of the Home Assistant, and is used to allow the Home Assistant application to communication with the operating system.

$ wget https://github.com/home-assistant/os-agent/releases/download/1.7.2/os-agent_1.7.2_linux_aarch64.deb
2025-05-10 12:28:20 (2.75 MB/s) - ‘os-agent_1.7.2_linux_aarch64.deb’ saved [3043626/3043626]
$ sudo dpkg -i os-agent_*.deb
Selecting previously unselected package os-agent.
(Reading database ... 129177 files and directories currently installed.)
Preparing to unpack os-agent_1.7.2_linux_aarch64.deb ...
Unpacking os-agent (1.7.2)
...
$ sudo gdbus introspect --system --dest io.hass.os --object-path /io/hass/os
node /io/hass/os {
 interface org.freedesktop.DBus.Introspectable {
   methods:
     Introspect(out s out);
   signals:
   properties:
 };
 interface org.freedesktop.DBus.Properties {
   methods:
     Get(in  s interface,
         in  s property,
         out v value);
     GetAll(in  s interface,
            out a{sv} props);
     Set(in  s interface,
         in  s property,
         in  v value);
   signals:
     PropertiesChanged(s interface,
                       a{sv} changed_properties,
                       as invalidates_properties);
   properties:
 };
 interface io.hass.os {
   methods:
   signals:
   properties:
     @org.freedesktop.DBus.Property.EmitsChangedSignal("invalidates")
     readonly s Version = '1.7.2';
     @org.freedesktop.DBus.Property.EmitsChangedSignal("true")
     readwrite b Diagnostics = false;
 };
};


2.7 Download and install the latest Home Assistant Application

$ wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
2025-05-10 12:32:47 (38.4 MB/s) - ‘homeassistant-supervised.deb’ saved [7492/7492]

$ sudo dpkg -i homeassistant-supervised.deb

2.8 Enable App Armour

In order to ensure that the addons are not blocked from installation, edit /boot/firmware/cmdline.txt, and append the following to the end of the line.
apparmor=1 security=apparmor

Then reboot the Pi.

$ sync; sudo reboot

3. Setting up a Dynamic DNS Name

It is essential that you have a contactable address for your modem.  This will require either having a static IP address and domain name, or using a dynamic address service - a list of some possible solutions can be found here - pick one which is supported by your modem!

For the rest of this article, we will assume that the domain myhass.dynip.org has been registered, and will always map to the Pi.

4. Setting Up Home Assistant

Connect to the home assistant http://homeassistant.local:8123/
Follow the setup procedure, creating a new installation, or restoring from a backup.

5. External Access - Simple

This is the simpler of the two options, and fully exposes the home assistant to the internet (protected by your username / password, of course).

Two external ports on the modem will need to be opened and forwarded to the Pi:

Port 80 - This port is used by letsencrypt to install certificates.  Ensure that the modem forwards this to the Pi on port 82.

Port 8123 - This port is used by Home Assistant, and is accessed by Google, and by the Home Assistant app when not on the local network.  This port number can be changed if desired. Ensure that the modem forwards this to the Pi on port 8123.

5.1 Port Forwarding

Add three port forwarding rules to the modem:
  • Internet WAN Port 80 -> Pi Port 80
  • Internet WAN Port 8123 -> Pi Port 8123
5.2 Setting up Home Assistant

Connect to Home Assistant via a web browser, and select Add-Ons / Lets Encrypt, and set the configuration as follows:

Domain: myhass.dynip.org
Email: myemail@myemailserver
Network Port: 82

Now edit the configuration.yaml file, and ensure that the http section looks like this:
http: ssl_certificate: /ssl/fullchain.pem ssl_key: /ssl/privkey.pem

Restart the homeassistant to use the updated configuration.yaml file.

On the Lets Encrypt Add-in page, select start, and test your configuration.

Note that once the certificate is installed, you will no longer be able to access http://homeassistant.local:8123/, you will have to access https://myhass.dynip.org:82/ instead.

If you want to be able to access via http for the local network, and https for the external network, check out the next section.

Once you are happy that the configuration is working OK, you can select  'Start on Boot' and 'Auto Update'.

5.2 External Access - Advanced

Letsencrypt is used to allow a https access to home assistant. An internet-facing port is opened, and the web server application nginx is used to act as a relay.

Note that this is only required if the Home Assistant needs to be controlled or accessed via the internet.

Note that in order for a Google smart speaker to complete actions on the Home Assistant, a https port to the internet must be opened.

The use of the relay allows for an additional layer of filtering to be performed in the nginx webserver relay.  It also allows for home assistant port 8123 to be accessible internally via http, whilst allowing external access via https.

We are going to set up a simple configuration, which uses three ports.

Port 80 - This port is used by the web server nginx 'http' protocol, and accessed by the LetsEncrypt certificate installation protocol.  It is not needed for any other reason - This should be left as port 80, but the nginx server access can limit access.

Port 8123 - This port is used by Home Assistant, and is accessed by Google, and by the Home Assistant app when not on the local network.  This port number can be changed if desired.

5.2 Port Forwarding To the Pi from the Router

Each router is different, however the following needs to be done in order to allow the Pi to be accessed from the internet.

5.2.1 Static IP Address

If using DHCP, in the router, ensure that the Pi is assigned a static IP address.

If you have changed the IP address of the Pi, ensure that it is rebooted before continuing.

5.2.2 Port Forwarding

Add three port forwarding rules to the modem:
  • Internet WAN Port 80 -> Pi Port 80
  • Internet WAN Port 8123 -> Pi Port 8123

5.3 Setting up Lets Encrypt and Nginx

Create /etc/nginx/sites-enabled/myhass.dynip.org

map $http_upgrade $connection_upgrade { default upgrade; '' close; }

server {
    root /var/www/html ;
    server_name myhass.dynip.org  ;
    autoindex off ; 
    listen 80 default_server ;
    listen [::]:80 default_server ;

}
Restart the nginx service:
$ sudo systemctl restart nginx
Install the Certificate:
$ sudo certbot --nginx 
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Enter email address (used for urgent renewal and security notices)
 (Enter 'c' to cancel): admin@dz2.vizier.uk

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.5-February-24-2025.pdf. You must
agree in order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: yes

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing, once your first certificate is successfully issued, to
share your email address with the Electronic Frontier Foundation, a founding
partner of the Let's Encrypt project and the non-profit organization that
develops Certbot? We'd like to send you email about our work encrypting the web,
EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
(Y)es/(N)o: no
Account registered.

Which names would you like to activate HTTPS for?
We recommend selecting either all domains, or all domains in a VirtualHost/server block.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: dz2.vizier.uk
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 1
Requesting a certificate for dz2.vizier.uk

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/dz2.vizier.uk/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/dz2.vizier.uk/privkey.pem
This certificate expires on 2025-08-10.
These files will be updated when the certificate renews.
Certbot has set up a scheduled task to automatically renew this certificate in the background.

Deploying certificate
Successfully deployed certificate for dz2.vizier.uk to /etc/nginx/sites-enabled/dz2.vizier.uk
Congratulations! You have successfully enabled HTTPS on https://dz2.vizier.uk

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

** TODO ** Edit /etc/nginx/sites-enabled/domain config file


Set LetsEncrypt to Automatically Refresh

crontab -e 
# m h  dom mon dow   command
2 2 * * * certbot renew


6. Linking to Google Assistant

This is quite a convoluted process, but a comprehensive description can be found here:

https://www.home-assistant.io/integrations/google_assistant/


This involves creating a project on the developer console, and linking it to your google account.

The developer console is found here: https://console.home.google.com/projects


7. Minimising Memory Card Writes

In order to maximise the life of the memory card, it is necessary to minimise the number of writes to it.  The fewer writes will also mean that if the power is lost, there is more chance that the memory card will survive without corruption.

7.1 Checking for Open Files
$ sudo lsof 2>/dev/null | awk 'NR==1 || $4~/[0-9]+[uw]/' | grep REG | grep -v /run | grep -v /var/log
7.2 Stopping Unwanted Services

systemctl stop lightdm colord cups cups-browser
systemctl disable lightdm colord cups cups-browser

7.3 Preventing Nginx from Logging

Ensure that the following lines are added /etc/nginx/sites-enabled/myhass.dynip.org
access_log off ;
error_log /dev/null crit ;

 

8. Errors and Debugging

Logs from the Google Smarthome functions can be found on the Google Cloud Logs Explorere here: https://console.cloud.google.com/logs

Logs from the LetsEncrypt (Simple) application can be found here: XXX

Logs from the LetsEncrypt (Advanced) application can be found here: XXX

Logs from the Nginx relay can be found here: XXX


8.1 There was a Problem Sensing the Home Assistant

When giving the sync my devices, the smart speaker respond with "There was a Problem Sensing the Home Assistant".

Check the Google Cloud Logs, and identify if there was an error which occurred at the same time as the sync request.

8.1.1 Problem Syncing - GAL_NOT_FOUND

If the error is GAL_NOT_FOUND, try to re-link your Home Assistant Test application via Google Home.
1. Run Google Home
2. Select Devices and +
3. Select Works with Google
4. Find the Test app
5. Agree to the terms

8.2 Unable to Fetch Auth Providers

When trying to link your Home Assistant Test application to your Google Assistant (Android App), you can find the Test App in the list of available services, but when you try to link, you get a message such i.e.:
1. Run Google Home
2. Select Devices and +
3. Select Works with Google
4. Find the Test app
5. Agree to the terms
Unable to fetch auth providers.  https://oauth-redirect.googleusercontent.com/[my-app-reference]

Clear the chrome browser cached files on the Android device:
1. Open Chrome browser
2. Select the ... menu
3. Select History
4. Select Delete Browsing Data
5. Ensure 'All Time' is selected
6. Ensure only 'Cached Images and Files' is selected
7. Select Delete Data

8.3 Only One Person Can Run Household (Home Assistant) Routines

When the system is set up, and a household routine is created in the Google Home application, or via the automation scripts on https://home.google.com/home can be run by one user, but other household users get an error message:
"There was a Problem Connecting to the Home Assistant"

Also, when inspecting the household routine, as soon as one user adds the Home Assistant scene to an automation via the Google Home Application, the scene disappears from other user's household routines.

Try the following ... 

1. Ensure that all household users have their voice recognised - i.e. each person can say 'OK Google, Who am I'. 
2. Ensure that all household users are included in the family group: https://myaccount.google.com/people-and-sharing 
3. Ensure that all household users are included in the Google Cloud Permissions: https://console.cloud.google.com/iam-admin/iam 
4. If the automation was created in the Google Home app, try deleting it and re-creating it as a Household Routine. 
5. Try deleting the automation from the Google Home app, and create it as an automation script on https://home.google.com/home. Note that this mechanism is considered by some as more powerful, however you do lose the ability to make an announcement to the speaker on which the request was made.

 8.4 When Linking Google Home to Home Assistant, I get a Corrupt Screen

  • Google Home / Settings / Works With Google / [test] Home Assistant
  • Continue / Agree
  • Takes me to a page with the words "Home Assistant" and a broken icon

Possibly - if you've been changing ports around in the nginx server or the google console, try flushing caches (didn't work for me) or waiting; or leaving google console settings alone and changing everything else to match.

8.5 When Linking Google Home to Home Assistant, I get the home assistant icon and 'unable to fetch auth providers'

Delete chrome browser history and try again

8.6 Google Automations have stopped working


Automations created on https://home.google.com/home don't fire when a command is given to a smart speaker.  

This may happen if the homeassistant is replaced  / re-linked to Google, and even though the names of the scenes / scripts are unchanged, Google no longer recognises them.

Open each <> script, select 'validate' and then save.

This will refresh the links.


---

Configuring Google

https://www.home-assistant.io/integrations/google_assistant/
https://console.home.google.com/projects



Logs

https://console.cloud.google.com/logs/query;cursorTimestamp=2025-05-12T08:59:52.933602620Z;duration=PT1H?project=smarthome-22c6e&authuser=0&inv=1&invt=AbxLoA