Home Assistant Remote access

browser → your own domain name → vps server ipv4 address → nginx on vps server → frps on  on vps server <--> frpc  on Raspberry Pi  <--> Home Assistant Server:8123

Quick start

buy a domain

buy a vps

Install nginx on vps

Install Cerbot on vps

Install frps on vps

 

Install frpc on Raspberry Pi 

Enable  the X-Forwarded-For in configuration.yaml

 

Securing Your Home Assistant Instance (Remote Access)

 

Securing Your domain(https) - Homeassistant Enable  HTTPS Certificates in Let's 

Securing Your Your Home Assistant Instance ipaddress(cf)

 

FRP proxy currently supports THTTP and HTTPS protocols.

 

Expose-Local-Server-behind-a-NAT-or-firewall-to-the-internet-using-FRP-Proxy-1.webp

FRP Architecture

 

Step-by-Step Guide

1.buy a domain

purchase your own domain name

https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step/page/2#3757

2.buy a vps server - for Install NGINX on your vps server

3. A to server - your own domain name point to vps server ipv4 address

4. install nginx - Install NGINX on your vps server

5. config nginx for your domain

6.install Let’s Encrypt client certbot - install Let’s Encrypt client certbot for nginx on vps server

7.downloaded SSL certificates for your domain

your own domain name → Connections → vps server ipv4 address → nginx on vps server → frps on  on vps server <-->Home Assistant Server on pi

Prepaire

Step 1.buy a domain-

https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step/page/2#3757

purchase your own domain name

Step 2.buy a vps server - for Install NGINX on your vps server

 

Step 3. domain A to ipv4 address on vps server - your own domain name point to vps server ipv4 address

 

4. install nginx - Install NGINX on your vps server 

https://www.msly.cn/boards/topic/3224/how-to-install-and-uninstall-reinstall-nginx-on-raspberry-piraspberry-pi-3b

How To Install and uninstall reinstall Nginx on raspberry pi(raspberry pi 3B+) 

https://www.msly.cn/boards/topic/3224/how-to-install-and-uninstall-reinstall-nginx-on-raspberry-piraspberry-pi-3b#3805

test run ok

5. config nginx for your domain

 

 

6.install Let’s Encrypt client certbot - install Let’s Encrypt client certbot for nginx on vps server

7.downloaded SSL certificates for your domain

Step 8:frpc on RPI p3b+

8.1 dowanlowd and Install frp client on debian 11 (RPI p3b+)

8.1.1 download frp for debian 11

https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step/page/1#2456

8.1.2 install frp client on rpi p3b+

https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step/page/2#3811

 

8.2 dowanlowd and Install frp server  on Ubuntu 20.04.5 LTS (vultr vps)

Ubuntu 20.04.5 LTS (GNU/Linux 5.4.0-132-generic x86_64)

8.2.1 download frp for Ubuntu 20.04.5 LTS

https://www.iaspnetcore.com/Blog/BlogPost/5e0fe8b42328b1510a1417b8/intranet-penetration-tool-frp-server-ubuntu-aliyun-client-windows#mcetoc_1g0sgbm7f50

 

8.2.2 Configure frp server on vps server

https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step/page/1#3467

 

8.3 dowanlowd and Install frpc Client  on Debain 12  Raspberry Pi OS Lite (64-bit) 

wget https://github.com/fatedier/frp/releases/download/v0.45.0/frp_0.45.0_linux_arm64.tar.gz
tar xzvf frp_0.45.0_linux_arm64.tar.gz
mv ./frp_0.45.0_linux_arm64/*  /usr/local/frp

8.3.1 Configure frpc client on pi

https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step#3467

8.3.2 Start frp Client on pi

/usr/local/frp/frpc -c /usr/local/frp/frpc.ini

http://localhost:4999/boards/topic/3224/how-to-install-and-uninstall-reinstall-nginx-on-raspberry-pialiyun-vps-server-frpraspberry-pi-3bhow-/page/1#28473

8.3.3  services

http://localhost:4999/boards/topic/3224/how-to-install-and-uninstall-reinstall-nginx-on-raspberry-pialiyun-vps-server-frpraspberry-pi-3bhow-/page/2#28474

8.3.4 Enable  the X-Forwarded-For in configuration.yaml

http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1      # Add the IP address of the proxy server
    - 127.0.0.0/24  # You may also provide the subnet mask
Scenario
  • Access to HA via browser is OK
  • Access to HA via HA App is Not OK - results in “Unable to Connect” error message
Background
  • Platform: Android (Samsung Galaxy S22 Ultra, Android v12)
  • Browser: Chrome/Samsung
  • Home Assistant Server: latest (2022.3.7)
  • Home Assistant companion app: latest (2022.3.0-full)
  • Access to HA is via Cloudflared/Argo tunnel
  • HA is behind Nginx Proxy Manager
Checklist
  • Cloudflare Zero trust cannot be used with the app
  • Make sure your homeassistant: settings are right, e.g.
  external_url: "https://ha.YOURDOMAIN.org"
  internal_url: "http://YOURLANIP:8123"
  • Also ensure your http: settings are right, e.g.
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24  # Add the IP address of the proxy server
    - 192.168.2.0/24
 
Solution
  • The issue was not with cloudfare, nginx or HA
  • The issue was resolved by disabling private DNS on the phone
Disabling Private DNS
 
Settings → Connections → More Connection Settings → Private DNS → Set to OFF Hope this helps someone

internal_url

You're about to give 

http://192.168.101.50:8123/access 

to your Home Assistant instance.

Logging in with Home Assistant Local.
 

Check home assisant core web server port only listen on 0.0.0.0.8123 ,port 80 and port 443 not exist

tcp        0      0 0.0.0.0:8123            0.0.0.0:*               LISTEN      822/python3.9
 

detail:https://www.msly.cn/boards/topic/30/how-to-install-frp-on-home-assistant-operating-systemhassos-on-raspberry-pi-step-by-step/page/1#3467

Comments


Comments are closed