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.
- Fire up Home Assistant - http://ip-address:8123.
- Go to the Supervisor.
- Go to "System" at the top of the page.
- In the "Host" card select "change" next to IP Address.
- On the Network Settings card choose the IPV4 option.
- Select the "Static" radio button
- Change the IP address on the line headed IP address/Netmask
- Press the "Save" option at the bottom of the card.
- Restart Home Assistant.
- 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 need to enable the following modules:-
a2enmod proxy_http a2enmod proxy_wstunnel a2enmod rewrite a2enmod ssl a2enmod mod_include
You will also need to add the following to the configuration.yaml file to make it work.
http: server_port: 8123 use_x_forwarded_for: true trusted_proxies: - 192.168.1.0/24