侧边栏壁纸
  • 累计撰写 270 篇文章
  • 累计创建 141 个标签
  • 累计收到 16 条评论

目 录CONTENT

文章目录

Home Assistant

Sherlock
2024-12-27 / 0 评论 / 0 点赞 / 4 阅读 / 0 字
温馨提示:
部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

暂时不需要了,常规的打洞只适用于http协议或者端口,homeassistant升级带了websocket协议,走http没法搞了,直接走了tcp穿透,本地无需nginx了,需要域名形式访问的话可以在穿透服务端配置Nginx

homeassistant nginx配置

先修改homeassistant的configuration.yaml

http:
  server_port: 8123
  cors_allowed_origins:
    - https://www.home-assistant.io
  use_x_forwarded_for: true
  trusted_proxies:
    - 127.0.0.1
    - ::1
    - 192.168.12.0/24
  ip_ban_enabled: true
  login_attempts_threshold: 5

Nginx 配置

注意新增了webdocket

upstream homeassistant {
    server 127.0.0.1:8123;
}

##  WebSocket connection depending on the variable.$http_upgrade
map $http_upgrade $connection_upgrade {
    default upgrade;
    ''      close;
}


server {
   #....

    location / {
        proxy_pass http://homeassistant;
        proxy_set_header Host $host;
        proxy_redirect http:// https://;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
    }
}    

官方文档:https://www.home-assistant.io/integrations/http

https://kingtam.win/archives/hass-nginx.html

0
IoT
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区