Home Assistant stuff

This page is for recording stuff I find out about Home Assistant that wasn't immediately obvious from the documentation in the hope that it will help someone else. 😀

I'm running my instance of Home Assistant on on a Raspberry Pi 4 so most of the stuff is going to be related to HomeassistantOS.

Setting a Static IP

After trying to follow the instructions on Github it turns out that there is a far simpler way for us newbies using HomeassistantOS and I guess Home Assistant Supervised.

  1. Fire up Home Assistant - http://ip-address:8123.
  2. Go to the Supervisor.
  3. Go to "System" at the top of the page.
  4. In the "Host" card select "change" next to IP Address.
  5. On the Network Settings card choose the IPV4 option.
  6. Select the "Static" radio button
  7. Change the IP address on the line headed IP address/Netmask
  8. Press the "Save" option at the bottom of the card.
  9. Restart Home Assistant.
  10. Test the new IP address - http://new-ip-address:8123

Thats it! No messing about with the command line interface and nmcli

PS. I'll sort some pictures when I get a few moments.

Apache Configuration

After searching around the web for a solution to setting up external access to HA I stumbled across this.

IP_address is the internal IP address of the machine where HA is installed


<VirtualHost ha_IP_address:443>
ServerName <fqdn>
ServerAdmin <email_address>

ErrorLog ${APACHE_LOG_DIR}/ha-error.log
CustomLog ${APACHE_LOG_DIR}ha-access.log combined

SSLProxyEngine on
SSLProxyVerify none
SSLProxyCheckPeerCN off
SSLProxyCheckPeerName off
SSLProxyCheckPeerExpire off

ProxyPreserveHost On
ProxyRequests off
ProxyPass /.well-known/ !
ProxyPass / http://IP_address:8123/
ProxyPassReverse / http://IP_address:8123/
ProxyPass /api/websocket ws://IP_address:8123/api/websocket
ProxyPassReverse /api/websocket ws://IP_address:8123/api/websocket

RewriteEngine on
RewriteCond %{REQUEST_URI} !^/.well-known/ [NC]
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*)  ws://IP_address:8123/$1 [P,L]
RewriteCond %{REQUEST_URI} !^/.well-known/ [NC]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*)  http://IP_address:8123/$1 [P,L]

<location IP_address>
Require all granted
</location>

You also need to enable the following modules:-

a2enmod proxy_http
a2enmod proxy_wstunnel
a2enmod rewrite
a2enmod ssl
a2enmod mod_include

The TLS/SSL certificates used on this website are issued by Let's Encrypt