原文:http://bbs.feng.com/read-htm-tid-10857822.html
Putty连接IP:22
user:pi
password:raspberry
查看附近wifi
sudo iwlist wlan0 scan
编辑wifi信息
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
填入wifi信息
network={
ssid="XXXX"
psk="XXXX"
}
control+o 回车 control+x 保存并退出编辑器。
重启树莓派
sudo reboot
sudo nano /etc/apt/sources.list
用#注释掉原先所有源
底部添加新源
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
按键盘上的Ctrl+X键,然后键入Y,再“回车”保存并退出
检查更新
sudo apt-get update
sudo apt-get install -y sambascreen git
查看系统信息
uname -a
· armv7(树莓派3)安装
curl -sL https://deb.nodesource.com/setup_4.x | sudo -E bash -
sudo apt-get install -y nodejs
· armv6(树莓派2)安装
引用自:http://blog.csdn.net/qq_21794603/article/details/68922029
wget https://nodejs.org/dist/v6.10.2/node-v6.10.2-linux-armv6l.tar.xz
xz -d node-v6.10.2-linux-armv6l.tar.xz
tar -xf node-v6.10.2-linux-armv6l.tar
mv node-v6.10.2-linux-armv6l node-v6.10.2-linux-armv6
进入node-v6.10.2-linux-armv6文件夹下的bin目录输入
./node -v
测试nodejs是否能正常使用。如果能显示版本号,表示能够正常使用。
为了让node和npm能够在所有的目录中都能够使用,我选择在已有的PATH路径中添加node和npm的链接,因为下载时的文件我放在了/home/pi路径下,所以配置的命令为:
sudo ln -s /home/pi/node-v6.10.2-linux-armv6/bin/node /usr/local/bin/node
sudo ln -s /home/pi/node-v6.10.2-linux-armv6/bin/npm /usr/local/bin/npm
删除链接为:
sudo rm /usr/local/bin/node
sudo rm /usr/local/bin/npm
sudo apt-get -y install libavahi-compat-libdnssd-dev
armv7:
sudo npm install -g --unsafe-perm homebridge hap-nodejs node-gyp
cd /usr/lib/node_modules/homebridge/
cd /usr/lib/node_modules/hap-nodejs/node_modules/mdns
armv6:
sudo npm install -g --unsafe-perm homebridge
sudo npm install -g --unsafe-perm hap-nodejs
sudo npm install -g --unsafe-perm node-gyp
sudo ln -s /home/pi/node-v6.10.2-linux-armv6/bin/node-gyp /usr/local/bin/node-gyp
sudo ln -s /home/pi/node-v6.10.2-linux-armv6/bin/homebridge /usr/local/bin/homebridge
cd /home/pi/node-v6.10.2-linux-armv6/lib/node_modules/homebridge/
sudo npm install --unsafe-perm bignum
cd /home/pi/node-v6.10.2-linux-armv6/lib/node_modules/hap-nodejs/node_modules/mdns
sudo node-gyp BUILDTYPE=Release rebuild
cd /
sudo npm install -g homebridge-homeassistant
homebridge
如果出现
config.json(/home/pi/.homebridge/config.json) not found.
ctrl+c 停止homebridge,输入
cd /home/pi/.homebridge
sudo nano config.json
粘贴
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "123-45-678"
},
"platforms": [
{
"platform": "HomeAssistant",
"name": "HomeAssistant",
"host": "http://192.168.1.200:8123",#修改为你的IP
"password": "yourapipassword",
"supported_types": ["fan", "garage_door", "input_boolean", "light", "lock", "media_player", "rollershutter", "scene", "switch"]
}
]
}
Ctrl+X键,输入 Y,保存退出
再运行homebridge
homebridge
打开你的iPhone,点击“家庭app”,看到了homebridge了吗?,点击它,然后“手动输入”123-45-678