『瀚思彼岸』» 智能家居技术论坛

 找回密码
 立即注册
查看: 31151|回复: 41

利用 Hassio 中 homebridge-broadlink-rm 将博联(黑豆等)接入 HomeKit

  [复制链接]

1

主题

11

帖子

165

积分

论坛分享达人

积分
165
金钱
154
HASS币
0
发表于 2018-1-3 15:20:10 | 显示全部楼层 |阅读模式
本帖最后由 扶梓 于 2018-1-3 15:24 编辑

此教程适用于将博联 RM Mini、博联 RM Pro 接入 Homebridge。可以用 Siri 或者 iOS 的家庭应用控制空调或其他红外、射频设备。
昨晚上苦苦爬了一夜的帖,翻遍了各种文档,官方非官方的,踩了无数的坑,今天我把我遇到的问题以及解决办法整理一下,以帮助即将接触或者踩了坑的朋友。不讲 Hassio 的安装,论坛里有足够多的教程。此教程默认阅读者具有一个已经安装完成 Hassio 并将其接入网络且开启了 Samba share 的树莓派。
一、安装 Homebridge 以及其插件 homebridge-broadlink-rm
安装 Homebridge。

snipaste_20180103_134108.png
snipaste_20180103_134222.png
Homebridge 需要添加的源为:
https://github.com/hassio-addons/repository

snipaste_20180103_134347.png
snipaste_20180103_134726.png
在 Homebridge 的 Plugins 中添加 homebridge-broadlink-rm 插件。这里需要注意的是,不能按照以前的方法只写插件部分,否则保存不了。完整 Options:

{
  "log_level": "info",
  "avahi_interfaces": "",
  "avahi_hostname": "Hassio",
  "avahi_domainname": "local",
  "enable_ipv6": true,
  "packages": [],
  "init_commands": [],
  "plugins": [
    "homebridge-broadlink-rm"
  ]
}


二、配置 config.json
找到 config.json,路径为 /Volumes/config/homebridge/config.json。这里推荐 Atom 作为编辑器。
注意:以下内容不能直接复制,需要根据自己的情况进行修改。另外,因为 json 不支持代码注释,复制此代码时一定要删除 // 及后面的注释内容。我另提供一份没有注释的文件。
{
  "bridge":
    {
    "name": "Homebridge for Home Assistant",//这个名字可以随便取
    "username": "XX:XX:XX:XX:XX:XX",//这里必须改,就是你树莓派的 mac 地址,可以从路由器获取
    "port": 51826,//不建议更改,默认就行
    "pin": "123-45-678"//这里面可以随便改
    },

  "accessories": [],

  "platforms":
  [
        {
    "platform": "HomeAssistant",
    "name": "HomeAssistant",
    "host": "http://8.8.8.8:8123",//这里必须改,是树莓派的内网地址,强烈建议在路由器里面给树莓派分配静态地址,端口默认 8123 就行
    "password": "XXXXXXXX",//密码可以自定义
    "supported_types": [
      "automation",
      "binary_sensor",
      "climate",
      "cover",
      "device_tracker",
      "fan",
      "group",
      "input_boolean",
      "light",
      "lock",
      "media_player",
      "scene",
      "sensor",
      "switch"
    ],
    "logging": true
    },
    {
      "platform":"BroadlinkRM",
      "name":"Broadlink RM",
      "hideScanFrequencyButton": false,//这是在 Homebridge 中隐藏 ScanFrequency 的按钮
      "hideLearnButton": false,//这是在 Homebridge 中隐藏 Learn 的按钮,初次不要隐藏,需要它来学习红外码
      "accessories":[
        {
          "name":"空调",//名字随便改
                  "host":"8.8.8.9",//这个必须改,是博联的内网地址,同样强烈建议在路由器里面给树莓派分配静态地址
          "type":"air-conditioner",
          "defaultCoolTemperature": 18,//用来设定制冷模式的默认温度
          "defaultheatTemperature": 30,//用来设定制热模式的默认温度
          "minTemperature": 16,//用来设定在 HomeKit 中显示的最小温度
          "maxTemperature": 32,//用来设定在 HomeKit 中显示的最大温度
          "pseudoDeviceTemperature": 16,//部分较老的空调没有自带温度传感器,如不设定,会返回 0 值,出现实际温度低于最小温度的错误,新空调基本不用设置,可以删除
          "data":{
            "off":"2600f8000001158913111335143514101435131113351411131113111335143513351435143513111410141014101410141014101311131114101410141014101410141014101410141014101410141014351311131113111410141014101410141014101335143613111311131014111310141014101411131113111311131113101410141014111311131113111311131113111311131113111311131113111311131113111311141014101410131113111311131113111410141014101410141013111311131114101410141014101410141014101311141014101410141014101410141014101435143513111335141014351410131113000d05",//关闭空调的红外码
            "temperature32":{
              "pseudo-mode":"heat",//制热模式/制冷模式
              "data":"2600f8000001148a1311133513361311133514101435131114101410143514351434143513351510141014101410141014101410141013111410141014101311141014101410131114101410141014101435141013111311141014101410130f161014101311141014101410131114101310151014341411141013111410141014101410141014101410141014101410141014101410140d17101410141014101410141014101410141014101311131114101311131113111410140e15111410130f160f14101411141014101410141014101311131113111410141014101410140e1610141013111435133613111311131113351410141013000d05"
            },//设定空调的温度为 32 度时发送的红外码,下略
            "temperature31":{
              "pseudo-mode":"heat",
              "data":"2600f8000001128c1113113712371113113712121237121311371237111313351435133613351411140f1510141014101410140e160e16101410140c1711141013111311130e1611131113111311131113351410141014111311131113111311131014101410141113111311131111131113111311371312131111121212121212121212141012131113111311131112141012121212121311131113131111131113111313111113131111131113111313111311111311131113111313111311131113111311131113111311131113111311131113111311131113111311131113111311131113111410143513111311131113351410141014000d05"
            },
            "temperature30":{
              "pseudo-mode":"heat",
              "data":"2600f8000001138a12131237113712121237121211371213111311371311123711381137123711131212121212121212121212121212111312121212121212121212121212121213111212121213111212371113111311131212121212121212121212121212111312121212121212121212121212371113121212121212121211131113111311131212121212121212121212121212111312121212121212121212121212121212121212121212121212121212121212131113111311121212121212121212121311131212111311121312111212121213111311131113111311131113111311121238111311121212121213361212121211000d05"
            },
            "temperature29":{
              "pseudo-mode":"heat",
              "data":"2600f8000001138b11131137123711131138121211371213113713111212133611371237123711131212121211131113111311131113111312121212121113121113111312121113121212121212121212371113111311131212121211131212111311131113111312121212121212121212111311381211121311131113111311131113111113131212121212121113111311131113111312121212121212121113111311131113121213111212121212121212121211131212121212121212131112121212121311121212121212121311121212121213111311121213121112121212131112131113111311131113121211371212121211000d05"
            },
            "temperature28":{
              "pseudo-mode":"heat",
              "data":"2600f8000001138b12121237113811131137121212371113121212121212113811371237113811131113111311131113111311131113111312121113111311131113111311131113121212121212121211381113111311131113111311131113111311131113111312121113111311131113111311371213111311131113111311131113111311131113111313111311111313111311131113111311131113111311131113111310141113111311131113111311131114101410140e161014101410141014101410150f150f150f150f150f150e150f1511140e160e1510150f150f1410141014111335143513351435143513111311141013000d05"
            },
            "temperature27":{
              "pseudo-mode":"heat",
              "data":"2600f8000001138b12121138113712121237111311381113113811371237121211371237123711121312121212121113111311131113111312121212121212121212111311131113121212121212121212371113111311131212121211131113111311131211121312121212121212121212111311381113111311131113111311131113111311131212121212121113121211131113111312121212121212121212121211131113121212121212121212121212121212121212131112121212121212121212121311131112121212121212121212121213111311131113111311121212121212131113113712371138113712121212121212000d05"
            },
            "temperature26":{
              "pseudo-mode":"heat",
              "data":"2600f8000001138b12121237113712121237111311381113111311381137121113371137133612121212121212121212121212121212121311131112121212121212121212121213111311121212121311371212121212121212131112121212121212121212121311131113111212121212121212371212121212121311121212121212121212121212121212121212121212121212121311131211121311121212121212121213111311131113111311131112131112131113111311131113111311131113111311131211121311131113111311131113121211131113111311131113111311131235131311371237113811131112121212000d05"
            },
            "temperature25":{
              "pseudo-mode":"heat",
              "data":"2600f8000001128c11131137123711131137121212371212123712121138111311371237113811131113111311131113111311131113111312121113111311131113111311131113121212121212121211381113111311131113111311131113111311131113111312121212121212121113111311381113111311131113111311131113111311131212121211131113111311131113111312121212121212121212111311131113121212121212121212121212121212131112121212121212121212121212121311131113111311131112121212121213111311131113111212131113111311131113111311371237123711131113111311000d05"
            },
            "temperature24":{
              "pseudo-mode":"heat",
              "data":"2600f8000001128c11131137123711131137131112371212121212121237121211381137123711131212121212121212121212121212121311121212121212121212121212121213111311131113111212371212121212121212121212121212121213111212121311121212121212121311121212371113121212121212121212121212121212131112121212121212121212121311121311131112121311121212121212121213111311131113111311131113111311131113111311131113111311131113111311131112121311131113111311131113121212121212121211131113111311131237123712121137123711131113111311000d05"
            },
            "temperature23":{
              "pseudo-mode":"heat",
              "data":"2600f80000011588151014341435140c1834150d17341410153414351410141014321635143415101410141014101410140f1510141013111410140f141113111311131113111311131113111311131113361311131113111311131111131113111311131113111312121212121211131113111311381113111311131113111311131113111311131212121211131113111311131113111312121212121212121212111311131113121212121212121212121212121212131113111212121212121212121212121311131113111311131112121212121213111311131113111311131113111311131113113712121237123711131113111311000d05"
            },
            "temperature22":{
              "pseudo-mode":"cool",
              "data":"2600f8000001138b12121336123613111237121211371312121212361312121112371138123613121212111312121113111311131113111311131113111311131113111311131113131111131113111312121137131211131113111311131113111311131113111311131212111311131113111311131113121212121212111311131113111311131212121212121212121213111212111312121311121212121212121212121213111311131112121212121212121212131113111311131113121211131112121311131113111311131212111311131113111311131113111311131113111311131212113811371212123711131113111311000d05"
            },
            "temperature21":{
              "pseudo-mode":"cool",
              "data":"2600f8000001128b12121237113811131137121212371113123711131113111311371237123711131212121212121212111311131113111312121212121212121212121212121113121212121212121212121237111311131212121212121212121212121212111312121212121212121212121212121213111311131112121212121212121212131113111311131113111311131112121311131113111311131113111311131113111311131113111311131113111311131212121211131113111311131113111312121212121212121212121211131113121212121212121212121212121212131137121212371113113712121212121212000d05"
            },
            "temperature20":{
              "pseudo-mode":"cool",
              "data":"2600f8000001138b12121137123712121138111311371213121211131113111311371237113712131113111311131113111311131113111311131113111311131113111311131113121212121212121211131138111311131113111312121113111311131113111312121212121211131113111312121113121212121212121212121212111311131212121212121212121212121212121311131112121212121212121212121213111311131113111311131112121212131113111311131113111311131112121312121212111311131113111311131113121212121113111311111313121211131212121212371113113712121212121212000d05"
            },
            "temperature19":{
              "pseudo-mode":"cool",
              "data":"2600f8000001158914101434143514101434150f153414101534143514341534141014351434150f150f15101410141014101410140e1610140e161014101410140e16101410140f150d171014101410141013351410150d161014111410130e170e16101311131113111311130f1511130f151014111311141013111311131113111311131113111410141014101410141014101311131114101410141014101410141014101411131113111311131014101410141014111311131113111311131113111311131113111311131114101311131113111311131113111311131113111311131113111311133613111311131113351410131113000d05"
            },
            "temperature18":{
              "pseudo-mode":"cool",
              "data":"2600f8000001128b13111237123711121237131013361213121212371137123712121237113712131113111311131113111311131113111311111412111312121113111311131113121212121212111311131138111212131212111311131113111311131113111312121212121211131212111311131113121212121212121212121212121211131212121212121212121212121212121311131112121212121212121212121213111311131113111312121112121212131113111311131113121211131113111311131212111311131113111311131113121212121212111311131113111311131336111311131113111311371212121212000d05"
            },
            "temperature17":{
              "pseudo-mode":"cool",
              "data":"2600f8000001158913111336133514101435131113351411143513101435133613111335143513111410141014101212131112121212121311131112121214101212121212121213111311131113111311131137121212131113111212121212121212121212121311131113111311131113111212121213111311131212111311131111131311131113111311131113111311131113111312121212121211131113111311131113121212121212121212121212121212121212121212121212121213111212121311131113111212131112121212121213111311131113111311131113111212131113111311131113111311371311121212000d05"
            },
            "temperature16":{
              "pseudo-mode":"cool",
              "data":"2600f8000001128c11131137123711131137121212371212121212121237123711131137123711131212121212121311121212121212121311121212131112121212121212121213111311131113111311121237121212131112121213111212121212121212131112131113111212121212121212121213111311131113111311131113111311131113121211131113111311131113111312121212111312121112121311131113121212121212121212121113111311131212121212121212121212121212121212121212121213111311121113121312111311131112121311121212121212131137123712371137123711131113111311000d05"
            }
          }
        }
      ]
    }
  ]
}


以上我是以长虹空调为例,配置完成并重启过后你可以在手机上接入 Homebridge 并看到 HomeKit 中有一个 Learn 的按钮,点击后你的博联 RM Mini、博联 RM Pro 指示灯将会常亮,此时遥控器对着你的博联按键红外码将出现在 Homebridge 的 logs 中,刷新一下,并将其复制到以上代码替换 data 后面的内容(Tips:logs 或者 data 中都只需要双击就能选取全部码,不用拖动选取)。另外你遥控器对应的什么样的状态,学习到的码控制空调也是一样的状态,所以进行红外码学习前先确定你遥控器的当前状态。例如:当前遥控器是 27℃、制热模式、开启了辅热、风向为自动、风速为自动,那我学习红外码的时候按一下温度+,学习到的码是控制空调调到 28 ℃、制热模式、开启了辅热、风向为自动、风速为自动。


至此,本帖结束,感谢阅读。






config.zip

1.78 KB, 下载次数: 251

评分

参与人数 2金钱 +25 收起 理由
neroxps + 7 谢谢分享!
+ 18 我来瀚思就为看你!

查看全部评分

回复

使用道具 举报

123

主题

4661

帖子

1万

积分

管理员

囧死

Rank: 9Rank: 9Rank: 9

积分
16410
金钱
11664
HASS币
45
发表于 2018-1-3 15:46:56 | 显示全部楼层
谢谢分享,楼主辛苦了!
回复

使用道具 举报

1

主题

11

帖子

165

积分

论坛分享达人

积分
165
金钱
154
HASS币
0
 楼主| 发表于 2018-1-3 15:49:29 | 显示全部楼层
Jones 发表于 2018-1-3 15:46
谢谢分享,楼主辛苦了!

囧帅。

评分

参与人数 1金钱 +10 收起 理由
+ 10 你这分少的太可怜了,再加点!.

查看全部评分

回复

使用道具 举报

40

主题

3056

帖子

1万

积分

超级版主

Nero

Rank: 8Rank: 8

积分
11149
金钱
8042
HASS币
182
发表于 2018-1-3 15:53:27 | 显示全部楼层
感谢分享~支持
回复

使用道具 举报

12

主题

397

帖子

2289

积分

金牌会员

Rank: 6Rank: 6

积分
2289
金钱
1892
HASS币
10
发表于 2018-1-3 15:53:46 | 显示全部楼层

谢谢分享
回复

使用道具 举报

1

主题

11

帖子

165

积分

论坛分享达人

积分
165
金钱
154
HASS币
0
 楼主| 发表于 2018-1-3 20:18:45 | 显示全部楼层

多谢囧帅。
回复

使用道具 举报

1

主题

16

帖子

55

积分

注册会员

Rank: 2

积分
55
金钱
39
HASS币
0
发表于 2018-1-6 05:11:12 | 显示全部楼层
谢谢分享
回复

使用道具 举报

0

主题

18

帖子

64

积分

注册会员

Rank: 2

积分
64
金钱
46
HASS币
0
发表于 2018-1-6 18:58:20 | 显示全部楼层
写的很不错啊
回复

使用道具 举报

1

主题

110

帖子

756

积分

高级会员

Rank: 4

积分
756
金钱
646
HASS币
0
发表于 2018-1-18 19:51:54 | 显示全部楼层
不错,很详细
回复

使用道具 举报

3

主题

29

帖子

113

积分

注册会员

Rank: 2

积分
113
金钱
84
HASS币
0
发表于 2018-1-21 23:11:10 | 显示全部楼层
多谢分享      
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Hassbian

GMT+8, 2024-11-24 00:09 , Processed in 0.521252 second(s), 35 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表