本帖最后由 czweb 于 2017-12-7 00:04 编辑
方法1:
####将homebridge设置成随系统启动######
cd /
sudo useradd --system homebridge
sudo mkdir /var/homebridge
sudo cp ~/.homebridge/config.json /var/homebridge/
sudo cp -r ~/.homebridge/persist /var/homebridge
sudo chmod -R 0777 /var/homebridge
cd /etc/default
sudo nano homebridge
#########将下面的内容复制粘贴进去,然后Ctrl+X,然后Y,回车,保存退出####
# Defaults / Configuration options for homebridge
# The following settings tells homebridge where to find the config.json file and where to persist the data (i.e. pairing and others)
HOMEBRIDGE_OPTS=-U /var/homebridge
# If you uncomment the following line, homebridge will log more
# You can display this via systemd's journalctl: journalctl -f -u homebridge
# DEBUG=*
####分界线#####################################
cd /etc/systemd/system
sudo nano homebridge.service
#########将下面的内容复制粘贴进去,然后Ctrl+X,然后Y,回车,保存退出####
[Unit]
Description=Node.js HomeKit Server
After=syslog.target network-online.target
[Service]
Type=simple
User=homebridge
EnvironmentFile=/etc/default/homebridge
ExecStart=/usr/lib/node_modules/homebridge/bin/homebridge $HOMEBRIDGE_OPTS
Restart=on-failure
RestartSec=10
KillMode=process
[Install]
WantedBy=multi-user.target
####分界线#####################################
cd /
sudo systemctl daemon-reload
sudo systemctl enable homebridge
sudo systemctl start homebridge
sudo systemctl status homebridge
sudo reboot ####重启树莓派####
###最后,你想返回去修改PIN码,MAC地址等等参数,可以按以下命令行来做####
sudo systemctl stop homebridge ###停止homebridge运行###
cd /var/homebridge ###进入目录###
sudo nano config.json ###编辑配置文件###
sudo reboot ###重启树莓派####
方法二: http://blog.csdn.net/conghua19/article/details/77934391
以上2个方法都试过了,开机后手机仍然无法连接homekit,
现在homebridge在命令提示符下直接输入homebridge启动是可以
|