Domoticz + BroadLink + Synology + Amazon Echo实现智能家居

Edit

Overview

此事缘起于在美帝买了Amazon Echo,想着回来可以在家里多说英语,给儿子一些熏陶,也是个大玩具,说不定人家会爱上呢。后来想着整天对Alexa吼这吼那的,如果能唤他帮咱开空调,开电视,开灯,那就不用整天操心遥控器了吗。尤其,整天盯着遥控器的主,拎着遥控器一摇一摆就走了,然后撒着欢儿跑回来,遥控器就不知道丢哪儿了。
首先查到的是BroadLink配件,这其实是一个WiFi转红外+射频的配件。我买的是这个。通过其自带的学习模式,可以学习任何一个遥控器的遥控码。配合Broadlink自家的app就已经可以实现遥控器电子化了。Broadlink有安卓上有两个app:

不够完美的是仍然需要掏出个手机,翻找app,一堆乱点。这不是我想要的。

继续百度,Google,如果要整合Amazon Echo——下文简称Alexa以图方便,有以下几种方案:

  1. 本身是智能化家居,并且厂家有对应的Skill,enable该Skill即可,好处是各种原生的设置,例如:空调设几度,灯开什么颜色
  2. 集成BroadLink,让Alexa操作BroadLink,此方案仍然有多种子方案:
    1) Android + Broadlink RM Plugin + Alexa
    2) Domoticz/Home Assistant + HA-Bridge + Alexa
    3) Domoticz + python plugin + controlicz + Alexa
    4) Broadlink原生skill + Alexa
  3. Domoticz/Home Assistant + HomeBridge + Siri

其中Domoticz和Home Assistant均为Home Automation System,网上两者都有很多人实践,各有优劣。在参考链接中专门对5种不同的系统进行了比较。因为我有Synology NAS,又可以原生集成,所以毫不犹豫选择了Domoticz。充分发挥NAS 7*24小时不下线的优势,实现智能家庭网关。针对第二点中的后3个(2-4)方案全部进行了实现。后面会一一列述。最终方案架构如下图:

Domoticz into Synology

这个超级简单。有官方支持Domoticz for Synology NAS。选择Domoticz for Synology DSM 6.1 with Python Plugin Beta。python plugin系统很重要,后面会用到。
下载的是.spk文件,这是Synology DSM系统的安装包。直接在Package Center中选择Manual Install即可。安装成功后如下图。

其他依赖包

Domoticz的python插件系统依赖于Python3
broadlink-http-rest server依赖于Python2
HA-Bridge Server依赖于 Java8
最好再装上git,方便checkout GitHub上的开源项目
所以这四个包都得安装,如下图

Broadlink into Domoticz

Domoticz Broadlink Python Plugin + Controlicz

这是本篇中最糟心的部分,陷阱无数。后面专录踩坑记录。
Domoticz Broadlink plugin和broadlink-http-rest均是基于python-broadlink。所以要先安装python-broadlink。

安装python-broadlink

在很多文章中python-broadlink都是用pip来安装,例如pip3 install broadlink。但是由于broadlink基于pycrypto,而安装pycrypto的时候会要在本地进行编译。Synology NAS上显然没有编译环境(GCC and etc.)。所以安装会失败。但是根据作者的描述,最新的python-broadlink并不基于pycrypto了,因为pycrypto已经被弃坑了。最新的python-broadlink基于pyaes库来实现加解密。所以正确的步骤是:

  • 确保使用python3
  • git clone python-broadlink
  • 切到python-broadlink目录,python setup.py install
  • python -m pip install pyaes因为Synology上无法安装pip3,这是变通的方法。使用python get-pip.py安装的仍然是pip2

安装Domoticz Python Plugin

参考链接3是插件作者提供的Domoiticz wiki页,不过全文基于Windows,参考其中others章节,仍然很好用。步骤如下:

  • 下载plugin files
  • Domoticz的插件目录在/usr/local/domoticz/var/plugins/BroadlinkRM2/,拷贝插件文件到该目录,包括:
    • plugin.py ——插件的主文件
    • plugin_send.py
    • plugin_http.py
    • plugin_http.sh
      这里需要注意插件目录不是/usr/local/domoticz/plugins/BroadlinkRM2/,虽然这个目录底下有example目录还有其他插件的目录,但当我把插件文件放在该目录下时,会出现插件未加载的情况。
  • 在Synology DSM的Package Center中重启Domoticz。注意后面每次修改plugin都需要重启Domoticz。
    至此安装就成功了,直接在Domoticz中添加BroadLink设备如图。

添加Broadlink Hardware

按照插件作者的步骤,下面应该可以添加Hardware,并可以Discover Broadlink设备,添加Hardware如下图:

导入易控(e-control)设备

参考链接3中也有详细描述。在User Guide->Inside Domoticz->xxx - import。可能作者使用的是非多字节语言,在处理导入文件时,若含有中文字,会出现失败的情况。参见踩坑记录中的解决方法。
另外还有一点要注意的是,在点击WebStart以后,Domoticz会开启一个运行于9000的web服务器,用以上传易控的设备文件(jsonButton, jsonIrCode, jsonSubIr)。要注意NAS的Firewall配置。

Controlicz

在搜索到的文章中鲜有提及。我也是在偶然的翻阅中发现了这个Alexa Skill。使用Controlicz就可以不用通过HA-Bridge来曲线救国了。但实际使用中发现还是各有利弊。后文讲完HA-Bridge章节,会提到两者的优缺点。
使用Controlicz的方法是:

  • 使用Alexa的账号来注册Controlicz
  • Alexa app上enable skill就好了
  • 对着Alexa说discover device

    注意:Controlcz中要求:

    • Domoticz服务必须外网可以访问,所以要配置家里的端口映射,以及DDNS,因为使用的是Synology,这个我早就已经有了
    • Controlicz要求Domoticz服务运行于HTTPS协议,所以必须使能8443端口,注意NAS的Firewall配置

踩坑记录

至此,如果能完成上面所有的步骤,对Alexa说”Turn on the TV”,应该已经会有正确响应了。但遗憾的是,中间还有一些东西要做:

Import Error “broadlink”

明明已经安装了python-broadlink,而且在REPL中也可以正确import,但是Domoticz log中始终报错。原因是PYTHONPATH不正确。在plugin.py中已有处理:
if sys.platform.startswith('linux'):
# linux specific code here
# doesn't work even if set dist-packages => site-packages
sys.path.append(os.path.dirname(os.__file__) + '/dist-packages')
elif sys.platform.startswith('darwin'):
# mac
sys.path.append(os.path.dirname(os.__file__) + '/site-packages')
elif sys.platform.startswith('win32'):
# win specific
sys.path.append(os.path.dirname(os.__file__) + '\site-packages')
正确的broadlink库路径是`/usr/local/lib/python3.5/site-packages/broadlink-0.5-py3.5.egg/broadlink/`。上面linux系统的路径是dist-package。不过即便改成site-packages,依然报同样的错误。解决方法简单明了,将broadlink目录拷到plugins目录下面即可

cp -r /usr/local/lib/python3.5/site-packages/broadlink-0.5-py3.5.egg/broadlink/ /usr/local/domoticz/var/plugins/BroadlinkRM2/

Error Connecting to Broadlink device

有两个GitHub issue链接可以看一看:
# broadlink/__init__.py
160 def encrypt_pyaes(self, payload):
161 aes = pyaes.AESModeOfOperationCBC(self.key, iv = bytes(self.iv))
162 return "".join([aes.encrypt(bytes(payload[i:i+16])) for i in range(0, len(payload), 16)]) # <==== Error is here

python3中bytes返回class bytes,而python2中返回字符串,如下:

Python2
>>> type(bytes([1,2,3]))
<type 'str'>

Python3
>>> type(bytes([1,2,3]))
<class 'bytes'>
>>> "".join([bytes([1,2]),bytes([2,3])]) <==== You cannot cat 2 bytes class objects as string
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: sequence item 0: expected str instance, bytes found
>>> b''.join([bytes([1,2]),bytes([2,3])]) <==== This is the good way
b'\x01\x02\x02\x03'

好了修改plugin.py对应的行就可以了。

Domoticz import文件中有中文的问题

在Python3中,如果文件有编码问题,例如包含中文,不能通过以下方式来读取文件并解码:

with open('jsonFile') as f:
textStr = f.read() <=== Python3 will complain about the codec error here.
textStr.decode('utf8')

正确的做法应当是

with open('jsonFile', encoding='utf8'):
textStr = f.read() <=== Everything here has already been unicode.

所以修改所有plugin.py中的open语句即可。
还有一处要修改的是针对ConfigParser的编码问题。如下是我修改好的:

config = configparser.ConfigParser()
config.read(path, encoding='utf8')

现在试一试,连接,发现,导入,应该都没问题了吧。

Domoticz + broadlink-http-rest + HA-Bridge

这个方案不需要借助Broadlink的Domoticz python插件,而是利用Domoticz中的Dummy Hardware,如下图:

安装HA-Bridge

HA-Bridge是将Alexa不支持的设备模拟成Alexa原生支持的Philips HUE Light。而HA-Bridge可以直接导入Domoticz中的所有设备。缺点是,他只能支持开关和调亮度的操作。
HA-Bridge是一个java的jar包,我们要将之作为service运行在Synology后台,方法参看Run as a service on Synology
其实就是运行命令nohup java -jar -Dserver.port=8085 /ha-bridge-4.5.6.jar &
注意放到Synology的计划任务里。

安装broadlink-http-rest

从GitHub上clone下broadlink-http-rest。然后和HA-Bridge一样,要以service的方式运行在后台。否则ssh连接一断开,server就退出了。命令为nohup python broadlink-http-rest/server.py &
注意要用nohup,否则serveer仍然会随着ssh断开而退出。

计划任务&防火墙

配置好防火墙:

  • 8085: HA-Bridge server
  • 8080: broadlink-http-rest server
  • 8443: Domoticz HTTPS service
  • 9000: Domoticz Broadlink web service

配置好计划任务:

Broadlink into Domoticz

在Setup->Hardware下建立Dummy Hardware,然后点击Create Virtual Sensors,然后在Switches tab里找到刚建好的virtual sensor,点击Edit,按下图配置好On Action和Off Action。

Domoticz into HA-Bridge

参见参考链接2,从Configuring HA bridge开始讲如何配置Domoticz到HA-Bridge service。然后就可以直接添加Domoticz里的设备了。

HA-Bridge vs. Controlicz

General Smart Home

Controlicz可以整合Domoticz所有设备到Alexa中,譬如,如果Alexa并不原生支持该smart home设备,则可以先在家里搭建Domoticz服务器,然后通过Controlicz将之整合到Alexa中。根据Controlicz官网support列表,其并不只局限于开关设备:

整合Broadlink

在整合Broadlink上,两者就各有胜场了。Broadlink是通用遥控器。所以通过Broadlink导入的设备都是按钮设备,每个按钮都是一个Push Button设备,所以只有一个触发的操作。这样也合理,因为按钮只有触发,并没有开状态或者关状态。这甚至不如灯的状态多。
例如:一台电风扇的开关按钮,按一下是开,再按一下是关。如果通过Controlicz直接整合Domoticz按钮设备,则要开电风扇,要对Alexa说“Turn on the Fan”,要关则还是说“Turn on the Fan”。是不是有点奇怪。
如果是HA-Bridge,针对开关状态,就可以说“Turn on the Fan”和“Turn off the Fan”。是不是好多了。
Controlicz整合Domoticz的好处就是,Domoticz Broadlink Python plugin支持直接一次性从易控导入已定义设备,可以充分发挥易控GUI的特点,省得一个一个设备自己定义了。

Broadlink原生Skill + IHC

在整完上面那一大堆之后,我突然发现原来Alexa已经有Broadlink的原生Skill了,但要配合最新版的Broadlink IHC app使用。不过令人糟心的是这两个app的评分都低的可怜。

  • IHC playstore 2.2分
  • Alexa Broadlink Skill 2.3分
    从官网的example看目前只支持TV。经我实践确实如此,添加了电视和空调,Alexa却只能discover到电视,没有空调。

参考链接

  1. 5 open source home automation tools
  2. Alex - Domoticz
  3. Domoticz Wiki Plugins/BroadlinkRM2
  4. #原创新人# 群晖安装broadlink-http-rest代替RMBridge_生活记录_什么值得买
%23Domoticz%20+%20BroadLink%20+%20Synology%20+%20Amazon%20Echo%u5B9E%u73B0%u667A%u80FD%u5BB6%u5C45%0A@%28myblog%29%5Bsynology%2C%20broadlink%2C%20domoticz%2C%20IoT%5D%0A%0A%23%23Overview%0A%u6B64%u4E8B%u7F18%u8D77%u4E8E%u5728%u7F8E%u5E1D%u4E70%u4E86Amazon%20Echo%uFF0C%u60F3%u7740%u56DE%u6765%u53EF%u4EE5%u5728%u5BB6%u91CC%u591A%u8BF4%u82F1%u8BED%uFF0C%u7ED9%u513F%u5B50%u4E00%u4E9B%u718F%u9676%uFF0C%u4E5F%u662F%u4E2A%u5927%u73A9%u5177%uFF0C%u8BF4%u4E0D%u5B9A%u4EBA%u5BB6%u4F1A%u7231%u4E0A%u5462%u3002%u540E%u6765%u60F3%u7740%u6574%u5929%u5BF9Alexa%u543C%u8FD9%u543C%u90A3%u7684%uFF0C%u5982%u679C%u80FD%u5524%u4ED6%u5E2E%u54B1%u5F00%u7A7A%u8C03%uFF0C%u5F00%u7535%u89C6%uFF0C%u5F00%u706F%uFF0C%u90A3%u5C31%u4E0D%u7528%u6574%u5929%u64CD%u5FC3%u9065%u63A7%u5668%u4E86%u5417%u3002%u5C24%u5176%uFF0C%u6574%u5929%u76EF%u7740%u9065%u63A7%u5668%u7684%u4E3B%uFF0C%u62CE%u7740%u9065%u63A7%u5668%u4E00%u6447%u4E00%u6446%u5C31%u8D70%u4E86%uFF0C%u7136%u540E%u6492%u7740%u6B22%u513F%u8DD1%u56DE%u6765%uFF0C%u9065%u63A7%u5668%u5C31%u4E0D%u77E5%u9053%u4E22%u54EA%u513F%u4E86%u3002%0A%u9996%u5148%u67E5%u5230%u7684%u662FBroadLink%u914D%u4EF6%uFF0C%u8FD9%u5176%u5B9E%u662F%u4E00%u4E2AWiFi%u8F6C%u7EA2%u5916+%u5C04%u9891%u7684%u914D%u4EF6%u3002%u6211%u4E70%u7684%u662F%5B%u8FD9%u4E2A%5D%28https%3A//detail.tmall.com/item.htm%3Fspm%3Da230r.1.14.8.ebb2eb2Gs49Vt%26id%3D43623542607%26cm_id%3D140105335569ed55e27b%26abbucket%3D13%26skuId%3D77095242268%29%u3002%u901A%u8FC7%u5176%u81EA%u5E26%u7684%u5B66%u4E60%u6A21%u5F0F%uFF0C%u53EF%u4EE5%u5B66%u4E60%u4EFB%u4F55%u4E00%u4E2A%u9065%u63A7%u5668%u7684%u9065%u63A7%u7801%u3002%u914D%u5408Broadlink%u81EA%u5BB6%u7684app%u5C31%u5DF2%u7ECF%u53EF%u4EE5%u5B9E%u73B0%u9065%u63A7%u5668%u7535%u5B50%u5316%u4E86%u3002Broadlink%u6709%u5B89%u5353%u4E0A%u6709%u4E24%u4E2Aapp%uFF1A%0A-%20%5Be-control%5D%28https%3A//play.google.com/store/apps/details%3Fid%3Dcom.broadlink.rmt%29%20%0A-%20%5BIHC%5D%28https%3A//play.google.com/store/apps/details%3Fid%3Dcn.com.broadlink.econtrol.plus%29%u53EA%u6709play%20store%u4E0A%u6709%0A%0A%u4E0D%u591F%u5B8C%u7F8E%u7684%u662F%u4ECD%u7136%u9700%u8981%u638F%u51FA%u4E2A%u624B%u673A%uFF0C%u7FFB%u627Eapp%uFF0C%u4E00%u5806%u4E71%u70B9%u3002%u8FD9%u4E0D%u662F%u6211%u60F3%u8981%u7684%u3002%0A%0A%u7EE7%u7EED%u767E%u5EA6%uFF0CGoogle%uFF0C%u5982%u679C%u8981%u6574%u5408Amazon%20Echo%u2014%u2014%u4E0B%u6587%u7B80%u79F0Alexa%u4EE5%u56FE%u65B9%u4FBF%uFF0C%u6709%u4EE5%u4E0B%u51E0%u79CD%u65B9%u6848%uFF1A%0A1.%20%u672C%u8EAB%u662F%u667A%u80FD%u5316%u5BB6%u5C45%uFF0C%u5E76%u4E14%u5382%u5BB6%u6709%u5BF9%u5E94%u7684Skill%uFF0Cenable%u8BE5Skill%u5373%u53EF%uFF0C%u597D%u5904%u662F%u5404%u79CD%u539F%u751F%u7684%u8BBE%u7F6E%uFF0C%u4F8B%u5982%3A%u7A7A%u8C03%u8BBE%u51E0%u5EA6%uFF0C%u706F%u5F00%u4EC0%u4E48%u989C%u8272%0A2.%20%u96C6%u6210BroadLink%uFF0C%u8BA9Alexa%u64CD%u4F5CBroadLink%uFF0C%u6B64%u65B9%u6848%u4ECD%u7136%u6709%u591A%u79CD%u5B50%u65B9%u6848%uFF1A%0A%091%29%20Android%20+%20%5BBroadlink%20RM%20Plugin%5D%28https%3A//play.google.com/store/apps/details%3Fid%3Dus.originally.tasker%29%20+%20Alexa%0A%092%29%20Domoticz/Home%20Assistant%20+%20%20%5BHA-Bridge%5D%28https%3A//github.com/bwssytems/ha-bridge%29%20+%20Alexa%0A%093%29%20Domoticz%20+%20python%20plugin%20+%20controlicz%20+%20Alexa%0A%094%29%20Broadlink%u539F%u751Fskill%20+%20Alexa%0A3.%20Domoticz/Home%20Assistant%20+%20HomeBridge%20+%20Siri%0A%0A%u5176%u4E2DDomoticz%u548CHome%20Assistant%u5747%u4E3AHome%20Automation%20System%uFF0C%u7F51%u4E0A%u4E24%u8005%u90FD%u6709%u5F88%u591A%u4EBA%u5B9E%u8DF5%uFF0C%u5404%u6709%u4F18%u52A3%u3002%u5728%u53C2%u8003%u94FE%u63A5%u4E2D%u4E13%u95E8%u5BF95%u79CD%u4E0D%u540C%u7684%u7CFB%u7EDF%u8FDB%u884C%u4E86%u6BD4%u8F83%u3002%u56E0%u4E3A%u6211%u6709Synology%20NAS%uFF0C%u53C8%u53EF%u4EE5%u539F%u751F%u96C6%u6210%uFF0C%u6240%u4EE5%u6BEB%u4E0D%u72B9%u8C6B%u9009%u62E9%u4E86Domoticz%u3002%u5145%u5206%u53D1%u6325NAS%207*24%u5C0F%u65F6%u4E0D%u4E0B%u7EBF%u7684%u4F18%u52BF%uFF0C%u5B9E%u73B0%u667A%u80FD%u5BB6%u5EAD%u7F51%u5173%u3002%u9488%u5BF9%u7B2C%u4E8C%u70B9%u4E2D%u7684%u540E3%u4E2A%282-4%29%u65B9%u6848%u5168%u90E8%u8FDB%u884C%u4E86%u5B9E%u73B0%u3002%u540E%u9762%u4F1A%u4E00%u4E00%u5217%u8FF0%u3002%u6700%u7EC8%u65B9%u6848%u67B6%u6784%u5982%u4E0B%u56FE%uFF1A%0A%21%5BAlt%20text%5D%28./1501339487875.png%29%0A%0A%23%23%20Domoticz%20into%20Synology%0A%u8FD9%u4E2A%u8D85%u7EA7%u7B80%u5355%u3002%u6709%u5B98%u65B9%u652F%u6301%5BDomoticz%20for%20Synology%20NAS%5D%28http%3A//www.jadahl.com/%29%u3002%u9009%u62E9%5BDomoticz%20for%20Synology%20DSM%206.1%20with%20Python%20Plugin%20Beta%5D%28http%3A//www.jadahl.com/domoticz_beta_6.1_python/%29%u3002python%20plugin%u7CFB%u7EDF%u5F88%u91CD%u8981%uFF0C%u540E%u9762%u4F1A%u7528%u5230%u3002%0A%u4E0B%u8F7D%u7684%u662F.spk%u6587%u4EF6%uFF0C%u8FD9%u662FSynology%20DSM%u7CFB%u7EDF%u7684%u5B89%u88C5%u5305%u3002%u76F4%u63A5%u5728Package%20Center%u4E2D%u9009%u62E9Manual%20Install%u5373%u53EF%u3002%u5B89%u88C5%u6210%u529F%u540E%u5982%u4E0B%u56FE%u3002%0A%21%5BAlt%20text%5D%28./1501340457645.png%29%0A%0A%23%23%20%u5176%u4ED6%u4F9D%u8D56%u5305%0ADomoticz%u7684python%u63D2%u4EF6%u7CFB%u7EDF%u4F9D%u8D56%u4E8EPython3%0Abroadlink-http-rest%20server%u4F9D%u8D56%u4E8EPython2%0A%5BHA-Bridge%20Server%5D%28https%3A//github.com/bwssytems/ha-bridge%29%u4F9D%u8D56%u4E8E%20Java8%0A%u6700%u597D%u518D%u88C5%u4E0Agit%uFF0C%u65B9%u4FBFcheckout%20GitHub%u4E0A%u7684%u5F00%u6E90%u9879%u76EE%0A%u6240%u4EE5%u8FD9%u56DB%u4E2A%u5305%u90FD%u5F97%u5B89%u88C5%uFF0C%u5982%u4E0B%u56FE%0A%21%5BAlt%20text%5D%28./1501340796886.png%29%21%5BAlt%20text%5D%28./1501340823935.png%29%21%5BAlt%20text%5D%28./1501340847466.png%29%0A%0A%23%23%20Broadlink%20into%20Domoticz%0A%0A%23%23%23%20Domoticz%20Broadlink%20Python%20Plugin%20+%20Controlicz%0A%u8FD9%u662F%u672C%u7BC7%u4E2D%u6700%u7CDF%u5FC3%u7684%u90E8%u5206%uFF0C%u9677%u9631%u65E0%u6570%u3002%u540E%u9762%u4E13%u5F55%u8E29%u5751%u8BB0%u5F55%u3002%0ADomoticz%20Broadlink%20plugin%u548C%5Bbroadlink-http-rest%5D%28https%3A//github.com/radinsky/broadlink-http-rest%29%u5747%u662F%u57FA%u4E8E%5Bpython-broadlink%5D%28https%3A//github.com/mjg59/python-broadlink%29%u3002%u6240%u4EE5%u8981%u5148%u5B89%u88C5python-broadlink%u3002%0A%0A%23%23%23%23%20%u5B89%u88C5python-broadlink%0A%u5728%u5F88%u591A%u6587%u7AE0%u4E2Dpython-broadlink%u90FD%u662F%u7528pip%u6765%u5B89%u88C5%uFF0C%u4F8B%u5982%60pip3%20install%20broadlink%60%u3002%u4F46%u662F%u7531%u4E8Ebroadlink%u57FA%u4E8Epycrypto%uFF0C%u800C%u5B89%u88C5pycrypto%u7684%u65F6%u5019%u4F1A%u8981%u5728%u672C%u5730%u8FDB%u884C%u7F16%u8BD1%u3002Synology%20NAS%u4E0A%u663E%u7136%u6CA1%u6709%u7F16%u8BD1%u73AF%u5883%28GCC%20and%20etc.%29%u3002%u6240%u4EE5%u5B89%u88C5%u4F1A%u5931%u8D25%u3002%u4F46%u662F%u6839%u636E%u4F5C%u8005%u7684%u63CF%u8FF0%uFF0C%u6700%u65B0%u7684python-broadlink%u5E76%u4E0D%u57FA%u4E8Epycrypto%u4E86%uFF0C%u56E0%u4E3Apycrypto%u5DF2%u7ECF%u88AB%u5F03%u5751%u4E86%u3002%u6700%u65B0%u7684python-broadlink%u57FA%u4E8Epyaes%u5E93%u6765%u5B9E%u73B0%u52A0%u89E3%u5BC6%u3002%u6240%u4EE5%u6B63%u786E%u7684%u6B65%u9AA4%u662F%uFF1A%0A-%20%u786E%u4FDD%u4F7F%u7528python3%0A-%20git%20clone%20python-broadlink%0A-%20%u5207%u5230python-broadlink%u76EE%u5F55%uFF0C%60python%20setup.py%20install%60%0A-%20%60python%20-m%20pip%20install%20pyaes%60%u56E0%u4E3ASynology%u4E0A%u65E0%u6CD5%u5B89%u88C5pip3%uFF0C%u8FD9%u662F%u53D8%u901A%u7684%u65B9%u6CD5%u3002%u4F7F%u7528%60python%20get-pip.py%60%u5B89%u88C5%u7684%u4ECD%u7136%u662Fpip2%0A%0A%23%23%23%23%20%u5B89%u88C5Domoticz%20Python%20Plugin%0A%u53C2%u8003%u94FE%u63A53%u662F%u63D2%u4EF6%u4F5C%u8005%u63D0%u4F9B%u7684Domoiticz%20wiki%u9875%uFF0C%u4E0D%u8FC7%u5168%u6587%u57FA%u4E8EWindows%uFF0C%u53C2%u8003%u5176%u4E2Dothers%u7AE0%u8282%uFF0C%u4ECD%u7136%u5F88%u597D%u7528%u3002%u6B65%u9AA4%u5982%u4E0B%uFF1A%0A-%20%u4E0B%u8F7D%5Bplugin%20files%5D%28https%3A//www.dropbox.com/sh/htyghey9e402u4y/AACeb1cXqaPd9gBVl5TL3H36a%3Fdl%3D0%29%0A-%20Domoticz%u7684%u63D2%u4EF6%u76EE%u5F55%u5728%60/usr/local/domoticz/var/plugins/BroadlinkRM2/%60%uFF0C%u62F7%u8D1D%u63D2%u4EF6%u6587%u4EF6%u5230%u8BE5%u76EE%u5F55%uFF0C%u5305%u62EC%uFF1A%0A%09-%20plugin.py%20%u2014%u2014%u63D2%u4EF6%u7684%u4E3B%u6587%u4EF6%0A%09-%20plugin_send.py%0A%09-%20plugin_http.py%0A%09-%20plugin_http.sh%0A%09%u8FD9%u91CC%u9700%u8981%u6CE8%u610F%u63D2%u4EF6%u76EE%u5F55%u4E0D%u662F%60/usr/local/domoticz/plugins/BroadlinkRM2/%60%uFF0C%u867D%u7136%u8FD9%u4E2A%u76EE%u5F55%u5E95%u4E0B%u6709example%u76EE%u5F55%u8FD8%u6709%u5176%u4ED6%u63D2%u4EF6%u7684%u76EE%u5F55%uFF0C%u4F46%u5F53%u6211%u628A%u63D2%u4EF6%u6587%u4EF6%u653E%u5728%u8BE5%u76EE%u5F55%u4E0B%u65F6%uFF0C%u4F1A%u51FA%u73B0%u63D2%u4EF6%u672A%u52A0%u8F7D%u7684%u60C5%u51B5%u3002%0A-%20%u5728Synology%20DSM%u7684Package%20Center%u4E2D%u91CD%u542FDomoticz%u3002%u6CE8%u610F%u540E%u9762%u6BCF%u6B21%u4FEE%u6539plugin%u90FD%u9700%u8981%u91CD%u542FDomoticz%u3002%0A%u81F3%u6B64%u5B89%u88C5%u5C31%u6210%u529F%u4E86%uFF0C%u76F4%u63A5%u5728Domoticz%u4E2D%u6DFB%u52A0BroadLink%u8BBE%u5907%u5982%u56FE%u3002%0A%21%5BAlt%20text%5D%28./1500861858610.png%29%0A%0A%23%23%23%23%20%u6DFB%u52A0Broadlink%20Hardware%0A%u6309%u7167%u63D2%u4EF6%u4F5C%u8005%u7684%u6B65%u9AA4%uFF0C%u4E0B%u9762%u5E94%u8BE5%u53EF%u4EE5%u6DFB%u52A0Hardware%uFF0C%u5E76%u53EF%u4EE5Discover%20Broadlink%u8BBE%u5907%uFF0C%u6DFB%u52A0Hardware%u5982%u4E0B%u56FE%uFF1A%0A%21%5BAlt%20text%5D%28./1501368649742.png%29%0AIP%u53EF%u4EE5%u8BBE%u4E3A127.0.0.1%uFF0CMAC%u8BBE%u4E3A%u51680%uFF0C%u7136%u540E%u53EF%u4EE5%u901A%u8FC7%u63D2%u4EF6%u63D0%u4F9B%u7684%u53D1%u73B0%u529F%u80FD%u6765%u8FDE%u63A5broadlink%u8BBE%u5907%u3002%u53C2%u8003%u94FE%u63A53%u4E2D%u5747%u6709%u8BE6%u7EC6%u63CF%u8FF0%u3002%u4F46%u5B9E%u9645%u5E76%u4E0D%u90A3%u4E48%u987A%u5229%uFF0C%u53C2%u8003%u4E0B%u9762%u8E29%u5751%u8BB0%u5F55%u3002%0A%0A%0A%23%23%23%23%20%u5BFC%u5165%u6613%u63A7%28e-control%29%u8BBE%u5907%0A%u53C2%u8003%u94FE%u63A53%u4E2D%u4E5F%u6709%u8BE6%u7EC6%u63CF%u8FF0%u3002%u5728User%20Guide-%3EInside%20Domoticz-%3Exxx%20-%20import%u3002%u53EF%u80FD%u4F5C%u8005%u4F7F%u7528%u7684%u662F%u975E%u591A%u5B57%u8282%u8BED%u8A00%uFF0C%u5728%u5904%u7406%u5BFC%u5165%u6587%u4EF6%u65F6%uFF0C%u82E5%u542B%u6709%u4E2D%u6587%u5B57%uFF0C%u4F1A%u51FA%u73B0%u5931%u8D25%u7684%u60C5%u51B5%u3002%u53C2%u89C1%u8E29%u5751%u8BB0%u5F55%u4E2D%u7684%u89E3%u51B3%u65B9%u6CD5%u3002%0A%u53E6%u5916%u8FD8%u6709%u4E00%u70B9%u8981%u6CE8%u610F%u7684%u662F%uFF0C%u5728%u70B9%u51FBWebStart%u4EE5%u540E%uFF0CDomoticz%u4F1A%u5F00%u542F%u4E00%u4E2A%u8FD0%u884C%u4E8E9000%u7684web%u670D%u52A1%u5668%uFF0C%u7528%u4EE5%u4E0A%u4F20%u6613%u63A7%u7684%u8BBE%u5907%u6587%u4EF6%28jsonButton%2C%20jsonIrCode%2C%20jsonSubIr%29%u3002%u8981%u6CE8%u610FNAS%u7684Firewall%u914D%u7F6E%u3002%0A%0A%23%23%23%20Controlicz%0A%u5728%u641C%u7D22%u5230%u7684%u6587%u7AE0%u4E2D%u9C9C%u6709%u63D0%u53CA%u3002%u6211%u4E5F%u662F%u5728%u5076%u7136%u7684%u7FFB%u9605%u4E2D%u53D1%u73B0%u4E86%u8FD9%u4E2AAlexa%20Skill%u3002%u4F7F%u7528Controlicz%u5C31%u53EF%u4EE5%u4E0D%u7528%u901A%u8FC7HA-Bridge%u6765%u66F2%u7EBF%u6551%u56FD%u4E86%u3002%u4F46%u5B9E%u9645%u4F7F%u7528%u4E2D%u53D1%u73B0%u8FD8%u662F%u5404%u6709%u5229%u5F0A%u3002%u540E%u6587%u8BB2%u5B8CHA-Bridge%u7AE0%u8282%uFF0C%u4F1A%u63D0%u5230%u4E24%u8005%u7684%u4F18%u7F3A%u70B9%u3002%0A%u4F7F%u7528Controlicz%u7684%u65B9%u6CD5%u662F%uFF1A%0A-%20%u4F7F%u7528Alexa%u7684%u8D26%u53F7%u6765%u6CE8%u518C%5BControlicz%5D%28https%3A//www.controlicz.com/%29%0A-%20Alexa%20app%u4E0Aenable%20skill%u5C31%u597D%u4E86%0A-%20%u5BF9%u7740Alexa%u8BF4discover%20device%0A%3E%u6CE8%u610F%uFF1AControlcz%u4E2D%u8981%u6C42%uFF1A%0A%3E-%20Domoticz%u670D%u52A1%u5FC5%u987B%u5916%u7F51%u53EF%u4EE5%u8BBF%u95EE%uFF0C%u6240%u4EE5%u8981%u914D%u7F6E%u5BB6%u91CC%u7684%u7AEF%u53E3%u6620%u5C04%uFF0C%u4EE5%u53CADDNS%uFF0C%u56E0%u4E3A%u4F7F%u7528%u7684%u662FSynology%uFF0C%u8FD9%u4E2A%u6211%u65E9%u5C31%u5DF2%u7ECF%u6709%u4E86%0A%3E-%20Controlicz%u8981%u6C42Domoticz%u670D%u52A1%u8FD0%u884C%u4E8EHTTPS%u534F%u8BAE%uFF0C%u6240%u4EE5%u5FC5%u987B%u4F7F%u80FD8443%u7AEF%u53E3%uFF0C%u6CE8%u610FNAS%u7684Firewall%u914D%u7F6E%0A%0A%23%23%23%20%u8E29%u5751%u8BB0%u5F55%0A%u81F3%u6B64%uFF0C%u5982%u679C%u80FD%u5B8C%u6210%u4E0A%u9762%u6240%u6709%u7684%u6B65%u9AA4%uFF0C%u5BF9Alexa%u8BF4%22Turn%20on%20the%20TV%22%uFF0C%u5E94%u8BE5%u5DF2%u7ECF%u4F1A%u6709%u6B63%u786E%u54CD%u5E94%u4E86%u3002%u4F46%u9057%u61BE%u7684%u662F%uFF0C%u4E2D%u95F4%u8FD8%u6709%u4E00%u4E9B%u4E1C%u897F%u8981%u505A%uFF1A%0A%23%23%23%23%20Import%20Error%20%22broadlink%22%0A%u660E%u660E%u5DF2%u7ECF%u5B89%u88C5%u4E86python-broadlink%uFF0C%u800C%u4E14%u5728REPL%u4E2D%u4E5F%u53EF%u4EE5%u6B63%u786Eimport%uFF0C%u4F46%u662FDomoticz%20log%u4E2D%u59CB%u7EC8%u62A5%u9519%u3002%u539F%u56E0%u662FPYTHONPATH%u4E0D%u6B63%u786E%u3002%u5728plugin.py%u4E2D%u5DF2%u6709%u5904%u7406%uFF1A%0A%60%60%60%0Aif%20sys.platform.startswith%28%27linux%27%29%3A%0A%20%20%20%20%23%20linux%20specific%20code%20here%0A%20%20%20%20%23%20doesn%27t%20work%20even%20if%20set%20dist-packages%20%3D%3E%20site-packages%0A%20%20%20%20sys.path.append%28os.path.dirname%28os.__file__%29%20+%20%27/dist-packages%27%29%0Aelif%20sys.platform.startswith%28%27darwin%27%29%3A%0A%20%20%20%20%23%20mac%0A%20%20%20%20sys.path.append%28os.path.dirname%28os.__file__%29%20+%20%27/site-packages%27%29%0Aelif%20sys.platform.startswith%28%27win32%27%29%3A%0A%20%20%20%20%23%20%20win%20specific%0A%20%20%20%20sys.path.append%28os.path.dirname%28os.__file__%29%20+%20%27%5Csite-packages%27%29%0A%60%60%60%0A%u6B63%u786E%u7684broadlink%u5E93%u8DEF%u5F84%u662F%60/usr/local/lib/python3.5/site-packages/broadlink-0.5-py3.5.egg/broadlink/%60%u3002%u4E0A%u9762linux%u7CFB%u7EDF%u7684%u8DEF%u5F84%u662Fdist-package%u3002%u4E0D%u8FC7%u5373%u4FBF%u6539%u6210site-packages%uFF0C%u4F9D%u7136%u62A5%u540C%u6837%u7684%u9519%u8BEF%u3002%u89E3%u51B3%u65B9%u6CD5%u7B80%u5355%u660E%u4E86%uFF0C%u5C06broadlink%u76EE%u5F55%u62F7%u5230plugins%u76EE%u5F55%u4E0B%u9762%u5373%u53EF%0A%3Ecp%20-r%20/usr/local/lib/python3.5/site-packages/broadlink-0.5-py3.5.egg/broadlink/%20/usr/local/domoticz/var/plugins/BroadlinkRM2/%0A%0A%23%23%23%23%20Error%20Connecting%20to%20Broadlink%20device%0A%u6709%u4E24%u4E2AGitHub%20issue%u94FE%u63A5%u53EF%u4EE5%u770B%u4E00%u770B%uFF1A%0A-%20%5BError%20Connecting%20to%20Broadlink%20device%20%23107%5D%28https%3A//github.com/mjg59/python-broadlink/issues/107%29%0A-%20%5Blpad%20fix%20broken%3F%20%2397%5D%28https%3A//github.com/mjg59/python-broadlink/issues/97%29%0A%u6216%u8BB8%u4F1A%u6709%u5E2E%u52A9%uFF0C%u4F46%u5BF9%u4E8E%u6211%u7684%u95EE%u9898%u4E0D%u662F%u6B63%u89E3%u3002%0ARoot%20cause%u662Fbytes%u4F7F%u7528%u65B9%u6CD5%u4E0D%u5BF9%uFF0C%u9519%u8BEF%u7684%u5730%u65B9%u5728%u8FD9%u91CC%0A%60%60%60%0A%23%20broadlink/__init__.py%0A160%20%20%20def%20encrypt_pyaes%28self%2C%20payload%29%3A%0A161%20%20%20%20%20aes%20%3D%20pyaes.AESModeOfOperationCBC%28self.key%2C%20iv%20%3D%20bytes%28self.iv%29%29%0A162%20%20%20%20%20return%20%22%22.join%28%5Baes.encrypt%28bytes%28payload%5Bi%3Ai+16%5D%29%29%20for%20i%20in%20range%280%2C%20len%28payload%29%2C%2016%29%5D%29%20%23%20%3C%3D%3D%3D%3D%20Error%20is%20here%0A%60%60%60%0Apython3%u4E2Dbytes%u8FD4%u56DEclass%20bytes%uFF0C%u800Cpython2%u4E2D%u8FD4%u56DE%u5B57%u7B26%u4E32%uFF0C%u5982%u4E0B%uFF1A%0A%60%60%60%0APython2%0A%3E%3E%3E%20type%28bytes%28%5B1%2C2%2C3%5D%29%29%0A%3Ctype%20%27str%27%3E%0A%0APython3%0A%3E%3E%3E%20type%28bytes%28%5B1%2C2%2C3%5D%29%29%0A%3Cclass%20%27bytes%27%3E%0A%3E%3E%3E%20%22%22.join%28%5Bbytes%28%5B1%2C2%5D%29%2Cbytes%28%5B2%2C3%5D%29%5D%29%20%20%3C%3D%3D%3D%3D%20You%20cannot%20cat%202%20bytes%20class%20objects%20as%20string%0ATraceback%20%28most%20recent%20call%20last%29%3A%0A%20%20File%20%22%3Cstdin%3E%22%2C%20line%201%2C%20in%20%3Cmodule%3E%0ATypeError%3A%20sequence%20item%200%3A%20expected%20str%20instance%2C%20bytes%20found%0A%3E%3E%3E%20b%27%27.join%28%5Bbytes%28%5B1%2C2%5D%29%2Cbytes%28%5B2%2C3%5D%29%5D%29%20%3C%3D%3D%3D%3D%20This%20is%20the%20good%20way%0Ab%27%5Cx01%5Cx02%5Cx02%5Cx03%27%0A%60%60%60%0A%u597D%u4E86%u4FEE%u6539plugin.py%u5BF9%u5E94%u7684%u884C%u5C31%u53EF%u4EE5%u4E86%u3002%0A%0A%23%23%23%23%20Domoticz%20import%u6587%u4EF6%u4E2D%u6709%u4E2D%u6587%u7684%u95EE%u9898%0A%u5728Python3%u4E2D%uFF0C%u5982%u679C%u6587%u4EF6%u6709%u7F16%u7801%u95EE%u9898%uFF0C%u4F8B%u5982%u5305%u542B%u4E2D%u6587%uFF0C%u4E0D%u80FD%u901A%u8FC7%u4EE5%u4E0B%u65B9%u5F0F%u6765%u8BFB%u53D6%u6587%u4EF6%u5E76%u89E3%u7801%uFF1A%0A%60%60%60%0Awith%20open%28%27jsonFile%27%29%20as%20f%3A%0A%09textStr%20%3D%20f.read%28%29%20%3C%3D%3D%3D%20Python3%20will%20complain%20about%20the%20codec%20error%20here.%0A%09textStr.decode%28%27utf8%27%29%0A%60%60%60%0A%u6B63%u786E%u7684%u505A%u6CD5%u5E94%u5F53%u662F%0A%60%60%60%0Awith%20open%28%27jsonFile%27%2C%20encoding%3D%27utf8%27%29%3A%0A%09textStr%20%3D%20f.read%28%29%20%3C%3D%3D%3D%20Everything%20here%20has%20already%20been%20unicode.%0A%60%60%60%0A%u6240%u4EE5%u4FEE%u6539%u6240%u6709plugin.py%u4E2D%u7684open%u8BED%u53E5%u5373%u53EF%u3002%0A%u8FD8%u6709%u4E00%u5904%u8981%u4FEE%u6539%u7684%u662F%u9488%u5BF9ConfigParser%u7684%u7F16%u7801%u95EE%u9898%u3002%u5982%u4E0B%u662F%u6211%u4FEE%u6539%u597D%u7684%uFF1A%0A%60%60%60%0Aconfig%20%3D%20configparser.ConfigParser%28%29%0Aconfig.read%28path%2C%20encoding%3D%27utf8%27%29%0A%60%60%60%0A%u73B0%u5728%u8BD5%u4E00%u8BD5%uFF0C%u8FDE%u63A5%uFF0C%u53D1%u73B0%uFF0C%u5BFC%u5165%uFF0C%u5E94%u8BE5%u90FD%u6CA1%u95EE%u9898%u4E86%u5427%u3002%0A%0A%23%23%23%20Domoticz%20+%20broadlink-http-rest%20+%20HA-Bridge%0A%u8FD9%u4E2A%u65B9%u6848%u4E0D%u9700%u8981%u501F%u52A9Broadlink%u7684Domoticz%20python%u63D2%u4EF6%uFF0C%u800C%u662F%u5229%u7528Domoticz%u4E2D%u7684Dummy%20Hardware%uFF0C%u5982%u4E0B%u56FE%uFF1A%0A%21%5BAlt%20text%5D%28./1501376022176.png%29%0A%0A%23%23%23%23%20%u5B89%u88C5HA-Bridge%0AHA-Bridge%u662F%u5C06Alexa%u4E0D%u652F%u6301%u7684%u8BBE%u5907%u6A21%u62DF%u6210Alexa%u539F%u751F%u652F%u6301%u7684Philips%20HUE%20Light%u3002%u800CHA-Bridge%u53EF%u4EE5%u76F4%u63A5%u5BFC%u5165Domoticz%u4E2D%u7684%u6240%u6709%u8BBE%u5907%u3002%u7F3A%u70B9%u662F%uFF0C%u4ED6%u53EA%u80FD%u652F%u6301%u5F00%u5173%u548C%u8C03%u4EAE%u5EA6%u7684%u64CD%u4F5C%u3002%0AHA-Bridge%u662F%u4E00%u4E2Ajava%u7684jar%u5305%uFF0C%u6211%u4EEC%u8981%u5C06%u4E4B%u4F5C%u4E3Aservice%u8FD0%u884C%u5728Synology%u540E%u53F0%uFF0C%u65B9%u6CD5%u53C2%u770B%5BRun%20as%20a%20service%20on%20Synology%5D%28https%3A//github.com/bwssytems/ha-bridge/issues/310%29%u3002%0A%u5176%u5B9E%u5C31%u662F%u8FD0%u884C%u547D%u4EE4%60nohup%20java%20-jar%20-Dserver.port%3D8085%20/ha-bridge-4.5.6.jar%20%26%60%0A%u6CE8%u610F%u653E%u5230Synology%u7684%u8BA1%u5212%u4EFB%u52A1%u91CC%u3002%0A%0A%23%23%23%23%20%u5B89%u88C5broadlink-http-rest%0A%u4ECEGitHub%u4E0Aclone%u4E0B%5Bbroadlink-http-rest%5D%28https%3A//github.com/radinsky/broadlink-http-rest%29%u3002%u7136%u540E%u548CHA-Bridge%u4E00%u6837%uFF0C%u8981%u4EE5service%u7684%u65B9%u5F0F%u8FD0%u884C%u5728%u540E%u53F0%u3002%u5426%u5219ssh%u8FDE%u63A5%u4E00%u65AD%u5F00%uFF0Cserver%u5C31%u9000%u51FA%u4E86%u3002%u547D%u4EE4%u4E3A%60nohup%20python%20broadlink-http-rest/server.py%20%26%60%0A%u6CE8%u610F%u8981%u7528nohup%uFF0C%u5426%u5219serveer%u4ECD%u7136%u4F1A%u968F%u7740ssh%u65AD%u5F00%u800C%u9000%u51FA%u3002%0A%0A%23%23%23%23%20%u8BA1%u5212%u4EFB%u52A1%26%u9632%u706B%u5899%0A%u914D%u7F6E%u597D%u9632%u706B%u5899%uFF1A%0A%21%5BAlt%20text%5D%28./1501376973009.png%29%0A-%208085%3A%20HA-Bridge%20server%0A-%208080%3A%20broadlink-http-rest%20server%0A-%208443%3A%20Domoticz%20HTTPS%20service%0A-%209000%3A%20Domoticz%20Broadlink%20web%20service%0A%0A%u914D%u7F6E%u597D%u8BA1%u5212%u4EFB%u52A1%uFF1A%0A%21%5BAlt%20text%5D%28./1501377068095.png%29%0A%0A%23%23%23%23%20Broadlink%20into%20Domoticz%0A%u5728Setup-%3EHardware%u4E0B%u5EFA%u7ACBDummy%20Hardware%uFF0C%u7136%u540E%u70B9%u51FBCreate%20Virtual%20Sensors%uFF0C%u7136%u540E%u5728Switches%20tab%u91CC%u627E%u5230%u521A%u5EFA%u597D%u7684virtual%20sensor%uFF0C%u70B9%u51FBEdit%uFF0C%u6309%u4E0B%u56FE%u914D%u7F6E%u597DOn%20Action%u548COff%20Action%u3002%0A%21%5BAlt%20text%5D%28./1501376159204.png%29%0A%u8FD9%u91CCon%20off%20action%u5C31%u662F%u5229%u7528broadlink-http-rest%20service%u6765%u63A7%u5236broadlink%u5B66%u4E60%uFF0C%u5E76%u53D1%u9001%u547D%u4EE4%u5230broadlink%u6765%u5B9E%u73B0%u9065%u63A7%u529F%u80FD%u3002%u4F8B%u5982%uFF1Ahttp%3A//192.168.1.2%3A8080/learnCommand/kogntiaokai%20%u540Ebroadlink%20rm%u4F1A%u8FDB%u5165%u5B66%u4E60%u72B6%u6001%uFF0C%u4EAE%u9EC4%u706F%u3002%u5BF9%u7740%u6309%u9065%u63A7%u5668%u6309%u94AE%u5C31%u5B66%u4E60%u4E86%u3002%u8FD9%u91CCkongtiaokai%uFF08%u7A7A%u8C03%u5F00%uFF09%u662F%u81EA%u5DF1%u5B9A%u4E49%u7684%u9065%u63A7%u540D%u79F0%uFF0C%u5B66%u4E60%u4E0B%u4E00%u4E2A%u547D%u4EE4%u65F6%u628A%u8FD9%u4E2A%u5730%u65B9%u4FEE%u6539%u4E00%u4E0B%u5C31%u884C%u3002%u5B66%u4E60%u5B8C%u540E%u53EF%u4EE5%u5728%u6D4F%u89C8%u5668%u91CC%u9762%u8F93%u5165%20http%3A//192.168.1.2%3A8080/sendCommand/kongtiaokai%20%u6765%u8BA9broadlink%u53D1%u9001%u521A%u624D%u5B66%u4E60%u7684%u7EA2%u5916%u547D%u4EE4%uFF0C%u6765%u6D4B%u8BD5%u4E0B%u662F%u5426%u5B66%u4E60%u6210%u529F%u3002%0A%0A%23%23%23%23%20Domoticz%20into%20HA-Bridge%0A%u53C2%u89C1%u53C2%u8003%u94FE%u63A52%uFF0C%u4ECEConfiguring%20HA%20bridge%u5F00%u59CB%u8BB2%u5982%u4F55%u914D%u7F6EDomoticz%u5230HA-Bridge%20service%u3002%u7136%u540E%u5C31%u53EF%u4EE5%u76F4%u63A5%u6DFB%u52A0Domoticz%u91CC%u7684%u8BBE%u5907%u4E86%u3002%0A%21%5BAlt%20text%5D%28./1501401044317.png%29%0A%u6DFB%u52A0%u5B8C%u5C31%u662F%u8FD9%u6837%u5566%0A%21%5BAlt%20text%5D%28./1501403754697.png%29%0A%u6B64%u65F6%u5C31%u53EF%u4EE5%u901A%u8FC7Alexa%20discover%u4E86%u3002%u7136%u540E%u53EF%u4EE5%u7528Alexa%20turn%20on/off%u8BBE%u5907%u4E86%u3002%0A%0A%23%23%23%23%20HA-Bridge%20vs.%20Controlicz%0A%23%23%23%23%23%20General%20Smart%20Home%0AControlicz%u53EF%u4EE5%u6574%u5408Domoticz%u6240%u6709%u8BBE%u5907%u5230Alexa%u4E2D%uFF0C%u8B6C%u5982%uFF0C%u5982%u679CAlexa%u5E76%u4E0D%u539F%u751F%u652F%u6301%u8BE5smart%20home%u8BBE%u5907%uFF0C%u5219%u53EF%u4EE5%u5148%u5728%u5BB6%u91CC%u642D%u5EFADomoticz%u670D%u52A1%u5668%uFF0C%u7136%u540E%u901A%u8FC7Controlicz%u5C06%u4E4B%u6574%u5408%u5230Alexa%u4E2D%u3002%u6839%u636EControlicz%u5B98%u7F51support%u5217%u8868%uFF0C%u5176%u5E76%u4E0D%u53EA%u5C40%u9650%u4E8E%u5F00%u5173%u8BBE%u5907%uFF1A%0A%21%5BAlt%20text%5D%28./1501404140819.png%29%0AHA-Bridge%u56E0%u4E3A%u662F%u5C06%u8BBE%u5907%u6A21%u62DF%u6210Philips%20HUE%uFF0C%u6240%u4EE5%u5BF9Alexa%u6765%u8BF4%uFF0C%u8FD9%u4E9B%u8BBE%u5907%u5C31%u53EA%u662F%u4E00%u4E2APhilips%20HUE%20Light%uFF0C%u6240%u4EE5%u53EA%u80FD%u6709%u5F00%u5173%u548C%u8C03%u4EAE%u5EA6%u4E09%u79CD%u52A8%u4F5C%u3002%0A%u4ECE%u8FD9%u4E2A%u89D2%u5EA6%u8BF4%uFF0C%u4E24%u8005%u5E76%u65E0%u53EF%u6BD4%u6027%uFF0CControlicz%u5B8C%u80DC%0A%23%23%23%23%23%20%u6574%u5408Broadlink%0A%u5728%u6574%u5408Broadlink%u4E0A%uFF0C%u4E24%u8005%u5C31%u5404%u6709%u80DC%u573A%u4E86%u3002Broadlink%u662F%u901A%u7528%u9065%u63A7%u5668%u3002%u6240%u4EE5%u901A%u8FC7Broadlink%u5BFC%u5165%u7684%u8BBE%u5907%u90FD%u662F%u6309%u94AE%u8BBE%u5907%uFF0C%u6BCF%u4E2A%u6309%u94AE%u90FD%u662F%u4E00%u4E2APush%20Button%u8BBE%u5907%uFF0C%u6240%u4EE5%u53EA%u6709%u4E00%u4E2A%u89E6%u53D1%u7684%u64CD%u4F5C%u3002%u8FD9%u6837%u4E5F%u5408%u7406%uFF0C%u56E0%u4E3A%u6309%u94AE%u53EA%u6709%u89E6%u53D1%uFF0C%u5E76%u6CA1%u6709%u5F00%u72B6%u6001%u6216%u8005%u5173%u72B6%u6001%u3002%u8FD9%u751A%u81F3%u4E0D%u5982%u706F%u7684%u72B6%u6001%u591A%u3002%0A%u4F8B%u5982%uFF1A%u4E00%u53F0%u7535%u98CE%u6247%u7684%u5F00%u5173%u6309%u94AE%uFF0C%u6309%u4E00%u4E0B%u662F%u5F00%uFF0C%u518D%u6309%u4E00%u4E0B%u662F%u5173%u3002%u5982%u679C%u901A%u8FC7Controlicz%u76F4%u63A5%u6574%u5408Domoticz%u6309%u94AE%u8BBE%u5907%uFF0C%u5219%u8981%u5F00%u7535%u98CE%u6247%uFF0C%u8981%u5BF9Alexa%u8BF4%u201CTurn%20on%20the%20Fan%u201D%uFF0C%u8981%u5173%u5219%u8FD8%u662F%u8BF4%u201CTurn%20on%20the%20Fan%u201D%u3002%u662F%u4E0D%u662F%u6709%u70B9%u5947%u602A%u3002%0A%u5982%u679C%u662FHA-Bridge%uFF0C%u9488%u5BF9%u5F00%u5173%u72B6%u6001%uFF0C%u5C31%u53EF%u4EE5%u8BF4%u201CTurn%20on%20the%20Fan%u201D%u548C%u201CTurn%20off%20the%20Fan%u201D%u3002%u662F%u4E0D%u662F%u597D%u591A%u4E86%u3002%0AControlicz%u6574%u5408Domoticz%u7684%u597D%u5904%u5C31%u662F%uFF0CDomoticz%20Broadlink%20Python%20plugin%u652F%u6301%u76F4%u63A5%u4E00%u6B21%u6027%u4ECE%u6613%u63A7%u5BFC%u5165%u5DF2%u5B9A%u4E49%u8BBE%u5907%uFF0C%u53EF%u4EE5%u5145%u5206%u53D1%u6325%u6613%u63A7GUI%u7684%u7279%u70B9%uFF0C%u7701%u5F97%u4E00%u4E2A%u4E00%u4E2A%u8BBE%u5907%u81EA%u5DF1%u5B9A%u4E49%u4E86%u3002%0A%0A%23%23%23%20Broadlink%u539F%u751FSkill%20+%20IHC%0A%u5728%u6574%u5B8C%u4E0A%u9762%u90A3%u4E00%u5927%u5806%u4E4B%u540E%uFF0C%u6211%u7A81%u7136%u53D1%u73B0%u539F%u6765Alexa%u5DF2%u7ECF%u6709Broadlink%u7684%u539F%u751FSkill%u4E86%uFF0C%u4F46%u8981%u914D%u5408%u6700%u65B0%u7248%u7684Broadlink%20IHC%20app%u4F7F%u7528%u3002%u4E0D%u8FC7%u4EE4%u4EBA%u7CDF%u5FC3%u7684%u662F%u8FD9%u4E24%u4E2Aapp%u7684%u8BC4%u5206%u90FD%u4F4E%u7684%u53EF%u601C%u3002%0A-%20IHC%20playstore%202.2%u5206%0A-%20Alexa%20Broadlink%20Skill%202.3%u5206%0A%u4ECE%u5B98%u7F51%u7684example%u770B%u76EE%u524D%u53EA%u652F%u6301TV%u3002%u7ECF%u6211%u5B9E%u8DF5%u786E%u5B9E%u5982%u6B64%uFF0C%u6DFB%u52A0%u4E86%u7535%u89C6%u548C%u7A7A%u8C03%uFF0CAlexa%u5374%u53EA%u80FDdiscover%u5230%u7535%u89C6%uFF0C%u6CA1%u6709%u7A7A%u8C03%u3002%0A%0A%0A%23%23%u53C2%u8003%u94FE%u63A5%0A1.%20%5B5%20open%20source%20home%20automation%20tools%5D%28https%3A//opensource.com/life/16/3/5-open-source-home-automation-tools%29%0A2.%20%5BAlex%20-%20Domoticz%5D%28https%3A//www.domoticz.com/wiki/Alexa%29%0A3.%20%5BDomoticz%20Wiki%20Plugins/BroadlinkRM2%5D%28http%3A//www.domoticz.com/wiki/Plugins/BroadlinkRM2.html%23First_Time_Users%29%0A4.%20%5B%23%u539F%u521B%u65B0%u4EBA%23%20%u7FA4%u6656%u5B89%u88C5broadlink-http-rest%u4EE3%u66FFRMBridge_%u751F%u6D3B%u8BB0%u5F55_%u4EC0%u4E48%u503C%u5F97%u4E70%5D%28https%3A//post.smzdm.com/p/551024/%29