IoT|硬體 |樹莓派|實作|安裝 Homebridge 並整合 openhab 2
安裝 Install the mdns and avahi library
sudo apt-get install libnss-mdns libavahi-compat-libdnssd-dev
首先移除舊版 node.js
sudo apt-get purge node node.js node.js -y
確認移除舊版 node.js
==================
sudo apt-get autoremove
安裝相關套件
sudo apt-get install git make
Automatic node.js installation;add repositories
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
安裝 node.js
sudo apt-get install -y nodejs
為確保系統軟體庫為最新狀態,請先執行系統更新
===================================
sudo apt-get update
sudo apt-get upgrade
檢查安裝好的 node.js and npm 版本
uname -a
安裝結過驗證
==========
Linux raspberrypi 4.4.50-v7+ 970 SMP Mon Feb 20 19:18:29 GMT 2017 armv7l GNU/Linux
node --version
版本內容
=======
v8.11.2
npm --v
版本內容
=======
5.6.0
安裝 Homebridge 套宴(避免檔案權限不足,需使用 roo 權限安裝)
sudo npm install -g --unsafe-perm homebridge
安裝 homebridge-openhab2 套件(避免檔案權限不足,需使用 roo 權限安裝)
sudo npm install -g --unsafe-perm homebridge-openhab2
編輯系統組態檔
nano /home/pi/.homebridge/config.json
{
  "bridge": {
    "name": "openHAB2",
    "username": "CC:22:3C:E3:CA:33",
    "port": 51826,
    "pin": "999-99-999"
  },
 "description": "This is an example configuration file with one fake accessory and one fake platform. You can use this as a template for creating your own configuration file containing devices you actually own.",
  "accessories": [
  ],
  "platforms": [
    {
      "platform": "openHAB2",
      "name": "openHAB2",
      "host": "192.168.100.210",
      "port": "8080",
      "sitemap": "default",
      "useLabelForName": true
    }
  ]
}
欄位說明
=======
 * "name" - 橋接器的名字
 * "username" - 以隨意改成 MAC 地址格式, Homebridge MAC 位置
 * "pin" - 家庭應用連接是所需要輸入的 PIN 碼
* "platform" - Must be set to openHAB2
* "name" - Name that you see in homekit
* "host" - IP address/host of the openHAB2 server
* "port" - Port of the openHAB2 server
* "sitemap" - Sitemap name of your openHAB2 server
啟動 Homebridge
homebridge
Switch KitchenLight "Kitchen Light" <light> (groupKitchen) [ "Switchable" ]
Color KitchenRGB "Kitchen RGB" <light> (groupKitchen) [ "Switchable" ]
Dimmer KitchenDimmer "Kitchen Dim" <light> (groupKitchen) [ "Switchable" ]
Switch KitchenLight "Kitchen Light" <light> (groupKitchen) [ "Lighting" ]
Color KitchenRGB "Kitchen RGB" <light> (groupKitchen) [ "Lighting" ]
Dimmer KitchenDimmer "Kitchen Dim" <light> (groupKitchen) [ "Lighting" ]
Color KitchenRGB "Kitchen RGB" <light> (groupKitchen) [ "Dimmable" ]
Dimmer KitchenDimmer "Kitchen Dim" <light> (groupKitchen) [ "Dimmable" ]
[參考]


 
 
 
留言
張貼留言