github上有大佬做了个homebridge,可以将一些苹果homekit不支持的硬件接入到homekit中
感谢望天创总裁的iPhone,感觉ios版本比较低。。。
1.homekit
百度百科

2.homebridge
1)介绍
是一个轻量的NodeJS服务,你可以在你家的局域网中运行这个来模拟IOS HomeKit API。它支持很多插件,提供基本的桥来将一些智能家居厂商提供的第三方API接入HomeKit
自从siri支持HomeKit设备,这意味着你可以通过Homebridge,用siri来控制那些不支持HomeKit的设备。
2)开源地址
https://github.com/nfarina/homebridge
3)插件搜索
https://www.npmjs.com/search?q=homebridge-plugin
可以看到很多插件哦!

3.树莓派上安装
环境: 树莓派3b,Linux raspberrypi 4.9.41-v7+
1)安装nvm nodejs版本控制器
$ sudo apt-get update
$ sudo apt-get install nvm
2)安装nodejs v8.3.0
实测这个版本npm bug少。。。
$ nvm install v8.3.0
3)安装完,查看
$ nvm ls

4)安装cnpm
npm的淘宝源,提升下载速度
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
5)安装homebridge(全局安装)
$ cnpm install -g homebridge
6)安装插件
找了个方便测试的插件
监测树莓派CPU温度的插件
全局安装
$ cnpm install -g homebridge-raspberrypi-temperature
7)配置homebridge
不配置,直接运行homebridge会报找不到配置文件的
进入到/home/pi/.homebridge
$ cd /home/pi/.homebridge
ls查看有木有config.json
,没有就创建
touch config.json
使用nano编辑,不用vim,因为不好复制.写完ctrl+x保存
$ nano config.json

截图里是两个插件,我们就用一个,看下面的配置

{
"bridge":{
"name":"ZZES-IOT",
"username":"3A:4E:2F:9B:0E:7C",
"port":52203,
"pin":"520-20-520"
},
"description":"ZZES Super IOT",
"accessories":[
{
"accessory":"RaspberryPiTemperature",
"name":"Pi-CPU-Tem"
}
]
}
8)运行homebridge
$ homebridge

4.iPhone上配置
注意:要和树莓派在同一局域网
1)去appstore下载家庭
这个App
2)打开家庭

3)点击添加配件
可以看到扫描到我的树莓派了

4)添加

点击手动添加

输入我们前面
config.json
里配置的pin码
5)成功添加
接下来就是一些分类什么的,一路下一步了。。。
图片.png
图片.png
6)查看


7)siri测试
之前用另一个同学手机试的

5.结束
有时间研究研究插件的写法
网友评论
正在铲了node 9 用node 8重新再试