2024年11月15日星期五 上午9:22:02

Home Assistant Remote access 2024.1.4(aliyun vps server+ frp+raspberry pi 3B+)How to install Raspberry Pi OS Lite (64-bit)

9 个月 前
#28474 引用
step 3.cp frpc.service
cp /etc/systemd/system/frpc.service /etc/systemd/system/

/etc/systemd/system/frpc.service


[Unit]
Description=Frp Client Service
After=network.target

[Service]
Type=simple
User=nobody
Restart=on-failure
RestartSec=5s
ExecStart=/usr/local/frp/frpc -c /usr/local/frp/frpc.ini

[Install]
WantedBy=multi-user.target
0
9 个月 前
#28475 引用
step 4:service


sudo systemctl daemon-reload
sudo systemctl enable frpc.service
sudo systemctl start frpc.service
sudo systemctl restart frpc.service
sudo systemctl stop frpc.service
sudo systemctl status frpc.service

sudo journalctl -fu frpc.service --since today


output

root@raspberrypi:~# sudo systemctl daemon-reload
root@raspberrypi:~# sudo systemctl status frpc.service
○ frpc.service - Frp Client Service
     Loaded: loaded (/etc/systemd/system/frpc.service; disabled; preset: enabled)
     Active: inactive (dead)

Feb 06 15:50:27 raspberrypi systemd[1]: [🡕] /etc/systemd/system/frpc.service:7: Special user nobody config>

root@raspberrypi:~# sudo systemctl status frpc.service
○ frpc.service - Frp Client Service
     Loaded: loaded (/etc/systemd/system/frpc.service; disabled; preset: enabled)
     Active: inactive (dead)

Feb 06 15:50:27 raspberrypi systemd[1]: [🡕] /etc/systemd/system/frpc.service:7: Special user nobody config>
Feb 06 15:50:55 raspberrypi systemd[1]: [🡕] /etc/systemd/system/frpc.service:7: Special user nobody config>

root@raspberrypi:~# sudo systemctl start frpc.service
root@raspberrypi:~# sudo systemctl status frpc.service
● frpc.service - Frp Client Service
     Loaded: loaded (/etc/systemd/system/frpc.service; disabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Tue 2024-02-06 15:51:17 GMT; 3s ago
    Process: 6622 ExecStart=/usr/local/frp/frpc -c /usr/local/frp/frpc.ini (code=exited, status=1/FAILURE)
   Main PID: 6622 (code=exited, status=1/FAILURE)
        CPU: 52ms
0
9 个月 前
#28476 引用
step x. copy frpc.ini
cp /usr/local/frp/frpc.ini /usr/local/frp/frpc.ini


step 5.Access to HA via browser is failure


browser errors as follow:
400: Bad Request


WebSocket connection to 'wss://ha.matterxiaomi.com/api/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400


you can be found in the Home Assistant frontend by going to Configuration > Settings > logs  show as follow:


Reason

use_x_forwarded_for boolean (optional, default: false)
Enable parsing of the X-Forwarded-For header, passing on the client’s correct IP address in proxied setups. You must also whitelist trusted proxies using the trusted_proxies setting for this to work. Non-whitelisted requests with this header will be considered IP spoofing attacks, and the header will, therefore, be ignored.


source:https://www.home-assistant.io/integrations/http

http://localhost:4999/boards/topic/3227/home-assistant-remote-access-test-step-by-stepcf-vpsnginxfrp-raspberry-pi-3b#3822
0
9 个月 前
#28477 引用
step 6:
Home Assistant Remote access - add use_x_forwarded_for: true docker first core 2024.1.5


Sloved

run ok
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
0
5 个月 前
#37266 引用
frpc无法自启动解决办法 - debain 12 frpc : inactive (dead)

Sloved

restart-frpc.sh

/data/frpc/restart-frpc.sh
0
5 个月 前
#37267 引用
添加x执行权限
/data/frpc# ls -l

-rwxr-xr-x 1 root root 1681 Jun  3 21:06 restart-frpc.sh
0
5 个月 前
#37268 引用
frpc_auto_run_script.service  - 系统启动时用于ssh自启动


[Unit]
Description=Script Frp Client Service
After=network.target network-online.target
Requires=network-online.target

[Service]
ExecStart=/data/frpc/restart-frpc.sh
Restart=always
RestartSec=1min

[Install]
WantedBy=multi-user.target
0
5 个月 前
#37269 引用
sudo systemctl daemon-reload
sudo systemctl enable frpc_auto_run_script.service
sudo systemctl start frpc_auto_run_script.service
sudo systemctl restart frpc_auto_run_script.service
sudo systemctl stop frpc_auto_run_script.service
sudo systemctl status frpc_auto_run_script.service

sudo journalctl -fu frpc_auto_run_script.service --since today
0