前情提要:米家 HomeBridge (HomeKit + 設定篇):有了 Mac,米家可以更智慧!

米家變身 HomeKit 前三篇已經把一般人最常用的小米檯燈、小米燈泡及小米網關…等都加入了「家庭」App,基本上算是包含了 70% 的米家智慧型裝置,接下來的就要開始加入一些單一的裝置了。

第四篇,就要教各位如何將「 小米空氣淨化器 」加入到「家庭」中!現在,廢話就不多說,讓我們開始吧!

支援設備

  • 小米空氣淨化器(MiAirPurifier)
  • 小米空氣淨化器 2(MiAirPurifier2)

將 小米空氣淨化器 加入 HomeBridge

跟前兩篇相同,我們還是需要用到「終端機」,不過最困難得部分其實威力都已經研究完了,各位只要跟著一步步操作即可,不用擔心。

Step 1. 安裝 homebridge-mi-air-purifier 插件

請在「應用程式」>「工具程式」>「終端機」輸入以下安裝插件的指令並執行:

sudo npm -g install homebridge-mi-air-purifier miio

Step 2. 取得小米空氣淨化器的相關信息

請先確認準備執行 HomeBridge 的電腦跟小米空氣淨化器是連上相同的 Wi-Fi,接著請繼續在「終端機」輸入指令:

miio discover

就可以看到現在所有連上 HomeBridge 的設備,可以看到 Model info:zhimi.airpurifier.m1 就是小米空氣淨化器,請將下方的 Address 及 Token 記下來。

已此圖為例,就是記下:

  • Address:192.168.xxx.250
  • Token:2bb240783419d5faxxxxxxxx81255eba

Step 3. 修改 config 文件

記下 Address 及 Token 後,就要將小米空氣淨化器的資訊加入至 config 設定檔。

請依序進入 Finder >「前往」>「前往檔案夾」。

輸入以下路徑:

~/.homebridge/

接著請打開 config.json 檔。

※ 可以使用「文字編輯」app 或是 TextWrangler 等類似的軟體開啟。

這個 config.json 檔裡的內容就是前三篇請各位建立的內容,現在因為安裝了 hombridge-mi-air-purifier 插件,所以需要再增加針對小米空氣淨化器的資訊。

請直接將以下的代碼複製並貼至 config.json,直接接在之前內容之下(記得上面要加個逗號),再把「ip」及「token」修改成 Step 2 記下來「Address」及「Token」即可:

"accessories": [

{

"accessory": "MiAirPurifier",

"name": "Air Purifier",

"ip": "192.168.xxx.250",

"token": "2bb240783419d5faxxxxxxxx81255eba",

"showTemperature": true,

"showHumidity": true,

"showAirQuality": true

}]
如果你的裝置都跟威力一樣,有 Yeelight 燈具、小米多功能網關跟小米空氣淨化器,然後也一路跟著系列文從第一篇一直加到第三篇,那你的 config.json 應該會是這樣:

※ 特別注意:記得上面要加個逗號,如上圖所示
如果你只想要把小米空氣淨化器加到「家庭」app 的話,你的 config.json 會是這樣:

Step 4. 執從 homebridge

在「應用程式」>「工具程式」>「終端機」中輸入:

homebridge

執行完就可以看到 homebridge 開始運作,下面就會出現 [Air Purifier] 的訊息了。

「家庭」App 設定小米空氣淨化器

接下來請開啟「家庭」app,就可以看到 Air Purifier 已經加入了,還多了空氣品質(Air Quality)、溼度(Humidity)跟溫度(Temperature)。

接來下就一個一個修改成相對應的名稱及位置就好,當然如果想直接用延用預設英文也可以。

結語

在「家庭」App 裡將 小米空氣清淨機 設定好之後,就可以直接在上方的概覽看到氣溫跟濕度摟!

在「家庭」App 的 小米空氣清淨機 裡可以設定以下功能:

  • 開/關
  • 設定 手動/自動 模式
  • 設定 兒童安全鎖
  • 顯示 溫度
  • 顯示 溼度
  • 顯示 空氣品質
然後最重要的就是可以叫 Siri 控制了,超棒的啊!!

小米空氣清淨機

接下來我會介紹如何把小米飛利浦智睿燈泡加入 HomeBridge 裡,敬請期待摟~

如果你對這系列的文章有興趣,請記得去 APPLE FANS 蘋果迷粉絲頁按讚並設為搶先看,我寫完新的文章都會第一時間發表在粉絲團。

關於作者

十多年前用了 Mac 後驚為天人,從此再也離不開蘋果,立誓要將捨棄 Windows 進入 Mac 後的美好傳遞給所有人,讓簡單純粹重回大家的生活。

49 篇迴響

  1. 請問我在加入config.json 的內容好像沒有新增好~終端機裡面出現這段話~是我哪邊沒有設定好嗎?感謝

    Loaded plugin: homebridge-aqara
    [2018-4-3 09:10:26] Registering platform ‘homebridge-aqara.AqaraPlatform’
    [2018-4-3 09:10:26] —
    [2018-4-3 09:10:26] Loaded plugin: homebridge-mi-air-purifier
    [2018-4-3 09:10:26] Registering accessory ‘homebridge-mi-air-purifier.MiAirPurifier’
    [2018-4-3 09:10:26] —
    [2018-4-3 09:10:26] There was a problem reading your config.json file.
    [2018-4-3 09:10:26] Please try pasting your config.json file here to validate it: http://jsonlint.com
    [2018-4-3 09:10:26]
    /usr/local/lib/node_modules/homebridge/lib/server.js:197
    throw err;
    ^

    SyntaxError: Unexpected token
    in JSON at position 407
    at Object.parse (native)
    at Server._loadConfig (/usr/local/lib/node_modules/homebridge/lib/server.js:191:19)
    at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:52:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:26:16)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

    • 兩台的話你試試看打這樣,把兩台分開,記得中間要加逗號,成功與否都再麻煩跟我說一聲,謝謝~
      “accessories”: [
      {
      “accessory”: “MiAirPurifier”,
      “name”: “Air Purifier”,
      “ip”: “192.168.xxx.250”,
      “token”: “2bb240783419d5faxxxxxxxx81255eba”,
      “showTemperature”: true,
      “showHumidity”: true,
      “showAirQuality”: true
      },
      {
      “accessory”: “MiAirPurifier”,
      “name”: “Air Purifier”,
      “ip”: “192.168.xxx.250”,
      “token”: “2bb240783419d5faxxxxxxxx81255eba”,
      “showTemperature”: true,
      “showHumidity”: true,
      “showAirQuality”: true
      }
      ]

      • 大大你好
        這樣的方式 還是只會讀到一台的資訊
        讀到下面一點那台

        有試過 但是下面這樣也無法執行 感謝感謝 我也還在想其他方式

        “name”: “Air Purifier” , “Air Purifier”,
        “ip”: “192.168.xxx.250”, “192.168.xxx.250”,
        “token”: “2bb240783419d5faxxxxxxxx81255eba”, “2bb240783419d5faxxxxxxxx81255eba”,
        “showTemperature”: true,
        “showHumidity”: true,
        “showAirQuality”: true

  2. 感謝大大 剛剛再好好debug一次
    你提供的方式可以了 不過我系統還沒很穩定
    不過確實已經可以看到兩台
    感謝

  3. 請問這什麼錯了 求救謝謝

    XXXXX-MacBook-Pro:.homebridge victorleong$ homebridge
    [6/5/2018, 2:03:25 PM] ====================
    [6/5/2018, 2:03:25 PM] ERROR LOADING PLUGIN homebridge-mi-air-purifier:
    [6/5/2018, 2:03:25 PM] /usr/local/lib/node_modules/homebridge-mi-air-purifier/index.js:281
    getLockPhysicalControls: async function(callback) {
    ^^^^^^^^

    SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:72:22)
    [6/5/2018, 2:03:25 PM] ====================
    [6/5/2018, 2:03:25 PM] No plugins found. See the README for information on installing plugins.
    [6/5/2018, 2:03:25 PM] Loaded config.json with 1 accessories and 0 platforms.
    [6/5/2018, 2:03:25 PM] —
    [6/5/2018, 2:03:25 PM] Loading 1 accessories…
    /usr/local/lib/node_modules/homebridge/lib/api.js:64
    throw new Error(“The requested accessory ‘” + name + “‘ was not registered by any plugin.”);
    ^

    Error: The requested accessory ‘MiAirPurifier’ was not registered by any plugin.
    at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:64:13)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:264:42)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

  4. {
    “bridge”: {
    “name”: “HomeBridge”,
    “username”: “B7:B7:B7:B7:BF:1B”,
    “port”: 55555,
    “pin”: “031-45-124”
    },
    “platforms”: [
    {
    “platform” : “yeelight”,
    “name” : “yeelight”
    },
    {
    “platform”: “MiAqaraPlatform”,
    “gateways”: {
    “XXXXXXXXXX”: “XXXXXXXXXXXXXXX”
    }
    },
    {
    “platform”: “MiPhilipsLightPlatform”,
    “deviceCfgs”: [{
    “type”: “MiPhilipsSmartBulb”,
    “ip”: “192.168.XX.XXX”,
    “token”: “XXXXXXXXXXXXXXXXXXXXXXXXXX”,
    “lightName”: “living room bulb”,
    “lightDisable”: false
    }]
    }, {
    “platform”: “MiPhilipsLightPlatform”,
    “deviceCfgs”: [{
    “type”: “MiPhilipsSmartBulb2”,
    “ip”: “192.168.XX.XXX”,
    “token”: “XXXXXXXXXXXXXXXXXXXXXXXXXX”,
    “lightName”: “living room bulb”,
    “lightDisable”: false

    }]
    }]
    }

    我寫這樣時 只顯示一個燈炮 大師求解 謝謝你

  5. Mikede-MBP:~ mikechou$ homebridge
    [2018-6-20 22:16:45] Loaded config.json with 1 accessories and 0 platforms.
    [2018-6-20 22:16:45] —
    [2018-6-20 22:16:45] ====================
    [2018-6-20 22:16:45] ERROR LOADING PLUGIN homebridge-mi-air-purifier:
    [2018-6-20 22:16:45] /usr/local/lib/node_modules/homebridge-mi-air-purifier/index.js:296
    getLockPhysicalControls: async function(callback) {
    ^^^^^^^^

    SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:72:22)
    [2018-6-20 22:16:45] ====================
    [2018-6-20 22:16:45] No plugins found. See the README for information on installing plugins.
    [2018-6-20 22:16:45] Loading 1 accessories…
    /usr/local/lib/node_modules/homebridge/lib/api.js:64
    throw new Error(“The requested accessory ‘” + name + “‘ was not registered by any plugin.”);
    ^

    Error: The requested accessory ‘MiAirPurifier’ was not registered by any plugin.
    at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:64:13)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:284:42)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:40:10)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    Mikede-MBP:~ mikechou$

    請問是發生了什麼事?謝謝

  6. [2018-8-19 21:21:49] Loaded config.json with 1 accessories and 0 platforms.
    [2018-8-19 21:21:49] —
    [2018-8-19 21:21:49] ====================
    [2018-8-19 21:21:49] ERROR LOADING PLUGIN homebridge-mi-air-purifier:
    [2018-8-19 21:21:49] /usr/local/lib/node_modules/homebridge-mi-air-purifier/index.js:296
    getLockPhysicalControls: async function(callback) {
    ^^^^^^^^

    SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:72:22)
    [2018-8-19 21:21:49] ====================
    [2018-8-19 21:21:49] No plugins found. See the README for information on installing plugins.
    [2018-8-19 21:21:49] Loading 1 accessories…
    /usr/local/lib/node_modules/homebridge/lib/api.js:64
    throw new Error(“The requested accessory ‘” + name + “‘ was not registered by any plugin.”);
    ^

    Error: The requested accessory ‘MiAirPurifier’ was not registered by any plugin.
    at API.accessory (/usr/local/lib/node_modules/homebridge/lib/api.js:64:13)
    at Server._loadAccessories (/usr/local/lib/node_modules/homebridge/lib/server.js:285:42)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:43:10)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    Gaode-MacBook-Pro:~ jackgao$

  7. [2018-8-20 01:23:39] Homebridge is running on port 54642.
    Device discovered at 192.168.1.39 is not Mi Air Purifier

    iPhone 上homekit一直顯示認不到裝置

  8. 我忘記了,我可能要回去看一下,看是用哪個plug in還有config.json的設定,還有,我確定我miio掃不到,我是自己從iphone裡面讀db檔的

  9. {
    “bridge”: {
    “name”: “HomeBridge”,
    “username”: “B8:27:EB:EE:AF:1B”,
    “port”: 54642,
    “pin”: “031-45-154”
    }
    },
    {
    “bridge”: {
    “name”: “HomeBridge”,
    “username”: “B8:27:EB:EE:AF:1B”,
    “port”: 54642,
    “pin”: “031-45-154”
    },
    “platforms”: [
    {
    “platform” : “yeelight”,
    “name” : “yeelight”
    },
    {
    “platform”: “MiAqaraPlatform”,
    “gateways”: {
    “7811dcfd68f6”: “COC22887E2D24E3D”
    }
    }]
    },
    這樣子對嗎?

  10. Last login: Sat Sep 1 22:26:17 on ttys000
    gaojinfade-iMac:~ gaojinfa$ homebridge
    [2018-9-1 22:32:03] There was a problem reading your config.json file.
    [2018-9-1 22:32:03] Please try pasting your config.json file here to validate it: http://jsonlint.com
    [2018-9-1 22:32:03]
    /usr/local/lib/node_modules/homebridge/lib/server.js:213
    throw err;
    ^

    SyntaxError: Unexpected token , in JSON at position 387
    at Object.parse (native)
    at Server._loadConfig (/usr/local/lib/node_modules/homebridge/lib/server.js:207:19)
    at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:56:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:28:16)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    gaojinfade-iMac:~ gaojinfa$
    就變這樣!但我把內容清homebridge竟能啟動

  11. {
    “bridge”: {
    “name”: “HomeBridge”,
    “username”: “B8:27:EB:EE:AF:1B”,
    “port”: 54642,
    “pin”: “031-45-154”
    }
    }

    {
    “platform”: “MiAqaraPlatform”,
    “gateways”: {
    “7811dcfd68f6”: “E7E9F23EEE144AD2”
    }
    }],
    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier”,
    “ip”: “192.168.0.22”,
    “token”: “def657d92db13fe6d918c189430f7cb7”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }],
    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier”,
    “ip”: “192.168.0.18”,
    “token”: “48fda6626fac335e7dbf727a33400183”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }],
    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier”,
    “ip”: “192.168.0.21”,
    “token”: “9c6db3e367d141072c1b8faf7208d04c”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }],
    這樣子對嗎?

  12. und.
    [2018-9-2 16:51:48] ====================
    [2018-9-2 16:51:48] ERROR LOADING PLUGIN homebridge-mi-air-purifier:
    [2018-9-2 16:51:48] /usr/local/lib/node_modules/homebridge-mi-air-purifier/index.js:296
    getLockPhysicalControls: async function(callback) {
    ^^^^^^^^

    SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:542:28)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Plugin.load (/usr/local/lib/node_modules/homebridge/lib/plugin.js:72:22)
    [2018-9-2 16:51:48] ====================
    [2018-9-2 16:51:48] Loaded plugin: homebridge-mi-aqara
    [2018-9-2 16:5
    又顯示錯誤!是哪有問題?求解?

  13. 幫忙解析一下這有啥錯?

    “bridge”: {
    “name”: “myhomekit”,
    “username”: “B8:27:EB:9D:F5:A0”,
    “port”:13358,
    “pin”: “388-08-007”
    },
    “platforms”: [
    {
    “platform”: “MiAqaraPlatform”,
    “gateways”: {
    “f0b429a9fb59”: “e7f7yvr59zsnaw7r”
    }],
    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier@guest bedroom”,
    “ip”: “10.1.10.96”,
    “token”: “abcb53f767de0971c58edf128028d7bf”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }],

    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier@living room”,
    “ip”: “10.1.10.29”,
    “token”: “8fedcf7889566aa68f0473d8c07829b3”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }]
    }

    系統是回饋說:
    pi@raspberrypi:~ $ homebridge
    [2018-10-31 20:15:44] There was a problem reading your config.json file.
    [2018-10-31 20:15:44] Please try pasting your config.json file here to validate it: http://jsonlint.com
    [2018-10-31 20:15:44]
    /usr/lib/node_modules/homebridge/lib/server.js:214
    throw err;
    ^

    SyntaxError: Unexpected token ] in JSON at position 307
    at JSON.parse ()
    at Server._loadConfig (/usr/lib/node_modules/homebridge/lib/server.js:208:19)
    at new Server (/usr/lib/node_modules/homebridge/lib/server.js:56:38)
    at module.exports (/usr/lib/node_modules/homebridge/lib/cli.js:30:16)
    at Object. (/usr/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)

  14. 抱歉,是幫忙看這個
    {
    “bridge”:{
    “name”:”HomeBridge”,
    “username”:”B8:27:EB:9D:F5:A0″,
    “port”:54642,
    “pin”:”520-03-520″
    },
    “platforms”:[
    {
    “platform”:”yeelight”,
    “name”:”yeelight”
    },
    {
    “platform”:”MiAqaraPlatform”,
    “gateways”:{
    “f0b429a9fb59″:”e7f7yvr59zsnaw7r”
    },
    {
    “platform”:”MiAqaraPlatform”,
    “gateways”:{
    “7811dcf7a326″:”4qgeidxz2ds5kgp9”
    }],
    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier@living Room”,
    “ip”: “10.1.10.29”,
    “token”: “8fedcf7889566aa68f0473d8c07829b3”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }]
    “accessories”: [
    {
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier@Guest Room”,
    “ip”: “10.1.10.96”,
    “token”: “abcb53f767de0971c58edf128028d7bf”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true
    }]

    • 你少了很多 },然後最後一段兩台清淨機應該要寫在 accessories 裡面才對。
      {
      “bridge”:
      {
      “name”:”HomeBridge”,
      “username”:”B8:27:EB:9D:F5:A0″,
      “port”:54642,
      “pin”:”520-03-520″
      },

      “platforms”:
      [
      {
      “platform”:”yeelight”,
      “name”:”yeelight”
      },
      {
      “platform”:”MiAqaraPlatform”,
      “gateways”:
      {
      “f0b429a9fb59″:”e7f7yvr59zsnaw7r”
      }
      },
      {
      “platform”:”MiAqaraPlatform”,
      “gateways”:
      {
      “7811dcf7a326″:”4qgeidxz2ds5kgp9”
      }
      }
      ],

      “accessories”:
      [
      {
      “accessory”: “MiAirPurifier”,
      “name”: “Air Purifier@living Room”,
      “ip”: “10.1.10.29”,
      “token”: “8fedcf7889566aa68f0473d8c07829b3”,
      “showTemperature”: true,
      “showHumidity”: true,
      “showAirQuality”: true
      },
      {
      “accessory”: “MiAirPurifier”,
      “name”: “Air Purifier@Guest Room”,
      “ip”: “10.1.10.96”,
      “token”: “abcb53f767de0971c58edf128028d7bf”,
      “showTemperature”: true,
      “showHumidity”: true,
      “showAirQuality”: true
      }
      ]
      }
      試試看

  15. 抱歉,系統還是報錯如下:再幫忙看看?

    [2018-11-2 15:40:53] Loaded config.json with 2 accessories and 3 platforms.
    [2018-11-2 15:40:53] —
    [2018-11-2 15:40:53] Loaded plugin: homebridge-mi-air-purifier
    [2018-11-2 15:40:53] Registering accessory ‘homebridge-mi-air-purifier.MiAirPurifier’
    [2018-11-2 15:40:53] —
    [2018-11-2 15:40:53] Loaded plugin: homebridge-mi-aqara
    [2018-11-2 15:40:53] Registering platform ‘homebridge-mi-aqara.MiAqaraPlatform’
    [2018-11-2 15:40:53] —
    failed to load BLE module!
    [2018-11-2 15:40:53] Loaded plugin: homebridge-yeelight
    [2018-11-2 15:40:53] Registering platform ‘homebridge-yeelight.yeelight’
    [2018-11-2 15:40:53] —
    [2018-11-2 15:40:53] Loading 3 platforms…
    [2018-11-2 15:40:53] [yeelight] Initializing yeelight platform…
    [2018-11-2 15:40:53] [yeelight] YeePlatform Init
    [2018-11-2 15:40:53] [MiAqaraPlatform] Initializing MiAqaraPlatform platform…
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO]**************************************************************
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO] MiAqaraPlatform v0.7.2 By YinHang
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO] GitHub: https://github.com/YinHangCode/homebridge-mi-aqara
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO] QQ Group: 107927710
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO]**************************************************************
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO]start success…
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO]config gateways: f0b429a9fb59
    [2018-11-2 15:40:53] [MiAqaraPlatform] [INFO]binding to the default interface
    [2018-11-2 15:40:53] [MiAqaraPlatform] Initializing MiAqaraPlatform platform…
    dgram.js:189
    throw new errors.Error(‘ERR_SOCKET_ALREADY_BOUND’);
    ^

    Error [ERR_SOCKET_ALREADY_BOUND]: Socket is already bound
    at Socket.bind (dgram.js:189:11)
    at MiAqaraPlatform.initServerAqaraLANProtocol (/usr/local/lib/node_modules/homebridge-mi-aqara/index.js:196:34)
    at new MiAqaraPlatform (/usr/local/lib/node_modules/homebridge-mi-aqara/index.js:63:10)
    at Server._loadPlatforms (/usr/local/lib/node_modules/homebridge/lib/server.js:326:32)
    at Server.run (/usr/local/lib/node_modules/homebridge/lib/server.js:86:36)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:45:10)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)

  16. Hi Willy,

    抱歉請教一下,家裡有一台米家空氣清靜機 2S。是否一定要加上網關才可以設定HomeKit 呢?
    因為我安裝好 兩個軟體後,在終端機輸入指令後一直說 password 不對。情況如下

    Last login: Tue Nov 20 18:15:53 on console
    MBPteki-MacBook-Pro-2:~ mbp$ sudo npm -g install homebridge-mi-air-purifier miio
    Password:
    Sorry, try again.
    Password:
    Sorry, try again.
    Password:
    sudo: 3 incorrect password attempts

    但是我的Mac已沒有設定密碼了。請指教。

    謝謝

  17. MBPteki-MacBook-Pro-2:~ mbp$ homebridge
    [2018-11-21 21:18:53] There was a problem reading your config.json file.
    [2018-11-21 21:18:53] Please try pasting your config.json file here to validate it: http://jsonlint.com
    [2018-11-21 21:18:53]
    /usr/local/lib/node_modules/homebridge/lib/server.js:214
    throw err;
    ^

    SyntaxError: Unexpected token , in JSON at position 155
    at Object.parse (native)
    at Server._loadConfig (/usr/local/lib/node_modules/homebridge/lib/server.js:208:19)
    at new Server (/usr/local/lib/node_modules/homebridge/lib/server.js:56:38)
    at module.exports (/usr/local/lib/node_modules/homebridge/lib/cli.js:30:16)
    at Object. (/usr/local/lib/node_modules/homebridge/bin/homebridge:17:22)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    MBPteki-MacBook-Pro-2:~ mbp$

    我的config 是
    {
    “bridge”:
    {
    “name”: “HomeBridge”,
    “username”: “B8:27:EB:EE:AF:1B”,
    “port”: 54642,
    “pin”: “031-45-154”
    }
    },

    “accessories”:{
    “accessory”: “MiAirPurifier”,
    “name”: “Air Purifier 2S bedroom”,
    “ip”: “192.168.1.30”,
    “token”: “ce9e6f1adac8adf1b9b3ff4e77bebe68”,
    “showTemperature”: true,
    “showHumidity”: true,
    “showAirQuality”: true

    }

發表評論