分页: 1 / 1

Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周二 5月 23, 2017 14:15
DT27
本帖以树莓派为例,默认路径为~(即用户主目录/home/pi/)。
本帖介绍手动编写脚本控制博联设备,仅供大家了解脚本及博联的控制方式。
实际使用建议用插件来控制博联设备,更加方便。
插件使用过程中遇到任何问题都可以在博联专区发帖讨论。

【Domoticz】基于v3.7974 Beta 博联专版
[Domoticz插件]Broadlink MP1/MP2 兼容 鸿雁8340J
[Domoticz插件]Broadlink SP mini
[插件]RM2 RMPro 插件 BroadlinkRM2 v3(增强版)



Domoticz要连接控制博联设备,需要一个名叫python-broadlink的Python项目。
python-broadlink项目地址:https://github.com/mjg59/python-broadlink
python-broadlink安装步骤:
①首先安装Python

代码: 全选

sudo apt-get install python2.7 -y
②然后安装Python包管理工具

代码: 全选

sudo apt-get install python-pip -y
sudo apt-get install python-dev libgmp-dev
③从GitHub网站直接下载项目代码需要用git,所以安装git

代码: 全选

sudo apt-get install git -y
④下载python-broadlink

代码: 全选

git clone https://github.com/mjg59/python-broadlink
这时,运行ls命令会看到当前目录中多了个python-broadlink文件夹。

⑤安装python-broadlink
进入python-broadlink文件夹

代码: 全选

cd python-broadlink
运行以下命令进行安装

代码: 全选

sudo python setup.py install
安装完成。
以上步骤均实践测试通过,如果你遇到任何问题,欢迎跟帖提问。

接下来通过python-broadlink连接并控制博联的各种设备。
博联RM系列万能遥控设备连接及控制方法,如RM mini、RM Home、RM Pro、RM2 Pro等
博联RM Pro获取内置温度传感器数据
博联MP系列智能插排设备连接及控制方法,如MP1、MP2等
博联SP系列智能插座设备连接及控制方法,如SP mini、SP mini3等

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周三 5月 24, 2017 10:12
sxren1
Mp系列插排链接无效了,能否重新做个教程,非常感谢

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周三 5月 24, 2017 10:41
DT27
sxren1 写了: 周三 5月 24, 2017 10:12 Mp系列插排链接无效了,能否重新做个教程,非常感谢
等等哈,昨天才开始写,刚把RM系列写完,马上开始写MP系列。

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周三 5月 24, 2017 11:00
DT27
sxren1 写了: 周三 5月 24, 2017 10:12 Mp系列插排链接无效了,能否重新做个教程,非常感谢
MP1教程已完成:博联MP系列智能插排设备连接及控制方法,如MP1、MP2等

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周五 5月 26, 2017 22:12
sxren1
pi@raspberrypi:/ $ sudo apt-get install python2.7 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
python2.7 is already the newest version.
python2.7 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 81 not upgraded.
这个是怎么回事,怎么解决啊

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周六 5月 27, 2017 08:19
DT27
sxren1 写了: 周五 5月 26, 2017 22:12 pi@raspberrypi:/ $ sudo apt-get install python2.7 -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
python2.7 is already the newest version.
python2.7 set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 81 not upgraded.
这个是怎么回事,怎么解决啊
直接贴到百度翻译一下啊,提示你python2.7已经安装了,直接继续下一步就行了。

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周六 6月 10, 2017 15:17
zhijilee
最后一步功亏一篑阿 :shock: :shock:
pi@raspberrypi:~/python-broadlink $ python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-2242.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python2.7/dist-packages/

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周六 6月 10, 2017 15:49
zhijilee
是否应该加个sudo...

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周六 6月 10, 2017 16:16
Admin
zhijilee 写了: 周六 6月 10, 2017 15:17 最后一步功亏一篑阿 :shock: :shock:
pi@raspberrypi:~/python-broadlink $ python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/test-easy-install-2242.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python2.7/dist-packages/

Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

https://pythonhosted.org/setuptools/easy_install.html

Please make the appropriate changes for your system and try again.
楼上说的对,得加sudo,帖子已经修正了

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周六 6月 10, 2017 19:40
suningwong
我在最后一步遇到错误
ImportError: No module named setuptools
是因为setuptools没有安装,可以采用命令安装
apt-get install -y python-setuptools
然后就可以了!

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周二 8月 15, 2017 01:58
macongran
Installed /usr/local/lib/python2.7/dist-packages/broadlink-0.5-py2.7.egg
Processing dependencies for broadlink==0.5
Searching for pycrypto==2.6.1
Reading https://pypi.python.org/simple/pycrypto/
Best match: pycrypto 2.6.1
Downloading https://pypi.python.org/packages/60/db/ ... 75d4eaf6f8 0f163/pycrypto-2.6.1.tar.gz#md5=55a61a054aa66812daf5161a0d5d7eda
error: Download error for https://pypi.python.org/packages/60/db/ ... 89219e0362 141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz#md5=55a61a054aa66812daf5161a0d5d7eda: [Errno 101] Network is unreachable

安装到这出错了,咋办,哪里出错了哎。。

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周一 4月 02, 2018 02:07
冰封紫轩
pi@raspberrypi:~/python-broadlink $ sudo python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/test-easy-install-934.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python2.7/dist-packages/

This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
出问题了。。。。

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周一 4月 02, 2018 09:06
blindlight
冰封紫轩 写了: 周一 4月 02, 2018 02:07 pi@raspberrypi:~/python-broadlink $ sudo python setup.py install
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

[Errno 2] No such file or directory: '/usr/local/lib/python2.7/dist-packages/test-easy-install-934.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

/usr/local/lib/python2.7/dist-packages/

This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
出问题了。。。。

直接

代码: 全选

pip3 install broadlink

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周一 8月 05, 2019 13:25
aka19801030
我的Domoticz和BroadLink RM pro+不在同一个网段,IP地址那里是否要填RM pro的外网地址?路由器要映射哪个端口?

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周一 11月 15, 2021 17:50
zhouyao123
博主你好,https://github.com/mjg59/python-broadlink
根据地址下载的源码是基于python3的版本,我使用了python2.7.14,下载的broadlink 0.6的版本,笔记本和wifi插座都是在一个路由下,但是socket发送消息始终收不到返回,大概是什么原因呢

Re: Domoticz&BroadLink(博联)连接及控制教程:(一)安装python-broadlink

发表于 : 周五 2月 18, 2022 22:07
obaby
可以看下调试日志,这个库本身也有一些问题,依赖于requests。建议切换到python3