Bỏ qua đến nội dung
There are many options to open external access for HASS

There are many options to open external access for HASS

There are many options to open external access for HASS. Cloudflared tunnel provides a more secure solution compared to traditional port forwarding, does not require a VPN, and works well whether you’ve installed it via Ambian or Ubuntu on a TV Box or Raspberry Pi. Below is a detailed and completely free guide.

Requirements

• A registered domain name
• A Cloudflare account (free)
• A Home Assistant system installed and running

Steps

  1. Register and configure the domain name with Cloudflare • Register a domain name from a provider (such as GoDaddy, Namecheap) or buy directly from Cloudflare • Create a Cloudflare account if you don’t have one • Add the domain to Cloudflare and follow the instructions to point the nameservers to Cloudflare
  2. Configure Home Assistant Add the following configuration to Home Assistant’s configuration.yaml file:
http:
  use_x_forwarded_for: true
  trusted_proxies:
    - 172.30.33.0/24

If you’re not sure how to edit this part, refer to the article on setting up a development environment for HASS. We need to perform the file editing operation through the Visual Code add-on or similar file editing tools.

Basic development environment setup guide for Home Assistant
To work conveniently based on the instructions on my blog, you need to set up a set of plugins from the beginning. These are indispensable utilities if you want to deeply intervene in the features of

Then restart Home Assistant to apply the configuration.

  1. Install the Cloudflared Add-on • Go to Home Assistant, then Settings > Add-Ons • Add the repository of the Cloudflared add-on: https://github.com/brenner-tobias/addon-cloudflared • Install the Cloudflared add-on
  2. Configure the Cloudflared Add-on
💡
In case you don’t have the add-on section, meaning HASS is installed via Docker, you can still find the docker-compose file for this service in the tunnel setup section where Cloudflare already shows the instructions. Just take that configuration and deploy it with docker-compose and you’re done, no additional installation needed.

There are two methods to set up a tunnel: Local tunnel (recommended) and Remote tunnel (advanced).

Local tunnel method (simple):

  1. Go to the Cloudflared add-on configuration
  2. Enter your domain name in the external_hostname field (for example: ha.example.com)
  3. Save the configuration and start the add-on
  4. Check the add-on logs; you will see a URL
  5. Open that URL in your browser to authenticate with Cloudflare

Remote tunnel method (advanced):

  1. Create a Cloudflare Tunnel in Cloudflare’s Zero Trust dashboard
  2. Get the tunnel token and enter it into the add-on configuration
  3. Start the add-on and check the logs

Bạn thấy bài viết hữu ích?

Đăng ký để nhận thông báo khi có bài viết mới.

Kiểm tra hộp thư để xác nhận email!
Bạn đã đăng ký thành công vào Geek Playground
Tuyệt vời! Tiếp theo, hoàn tất thanh toán để có quyền truy cập đầy đủ vào Geek Playground
Chào mừng trở lại! Bạn đã đăng nhập thành công.
Thành công! Tài khoản của bạn đã được kích hoạt đầy đủ, bạn hiện có quyền truy cập vào tất cả nội dung.
Thành công! Thông tin thanh toán của bạn đã được cập nhật.
Cập nhật thông tin thanh toán không thành công.