博联的sp mini 无线插座能在Domoticz中识别出来么?
发表于 : 周五 4月 14, 2017 12:10
我是用群晖安装的Domoticz和运行的broadlink-http-rest 和 Python-Broadlnk脚本来实现博联rm遥控器和Domoticz的整合。现在能实现在Domoticz中控制博联rm来遥控设备和获取博联rm的温度。请教高手能不能把博联的sp mini插座也集成进来?怎么实现?
代码: 全选
#!/usr/bin/python
import broadlink
import sys
device_ip="192.168.1.23"
device_port=80
device_mac="B4XXXXXXXX29"
device_type="broadlink.sp2"
action = str(sys.argv[1])
device = broadlink.sp2(host=(device_ip,device_port), mac=bytearray.fromhex(device_mac))
device.auth()
#device.host
if action == "on":
device.set_power(True)
elif action == "off":
device.set_power(False)
elif action == "status":
print "on" if device.check_power() else "off"
代码: 全选
script:///home/pi/domoticz/scripts/python/spmini.py on
代码: 全选
script:///home/pi/domoticz/scripts/python/spmini.py off
请问一下,编写spmini脚本之后,输入python spmini.py on执行脚本的时候出现DT27 写了: ↑周一 4月 17, 2017 08:43 博联的设备都可以用python-broadlink来连接控制。
SP Mini对应broadlink.sp2
python控制文件spmini.py代码:代码中device_ip跟device_mac改为spmini的。代码: 全选
#!/usr/bin/python import broadlink import sys device_ip="192.168.1.23" device_port=80 device_mac="B4XXXXXXXX29" device_type="broadlink.sp2" action = str(sys.argv[1]) device = broadlink.sp2(host=(device_ip,device_port), mac=bytearray.fromhex(device_mac)) device.auth() #device.host if action == "on": device.set_power(True) elif action == "off": device.set_power(False) elif action == "status": print "on" if device.check_power() else "off"
Domoticz中触发命令:开关代码: 全选
script:///home/pi/domoticz/scripts/python/spmini.py on
代码: 全选
script:///home/pi/domoticz/scripts/python/spmini.py off
ejlml 写了: ↑周四 6月 22, 2017 08:52请问一下,编写spmini脚本之后,输入python spmini.py on执行脚本的时候出现DT27 写了: ↑周一 4月 17, 2017 08:43 博联的设备都可以用python-broadlink来连接控制。
SP Mini对应broadlink.sp2
python控制文件spmini.py代码:代码中device_ip跟device_mac改为spmini的。代码: 全选
#!/usr/bin/python import broadlink import sys device_ip="192.168.1.23" device_port=80 device_mac="B4XXXXXXXX29" device_type="broadlink.sp2" action = str(sys.argv[1]) device = broadlink.sp2(host=(device_ip,device_port), mac=bytearray.fromhex(device_mac)) device.auth() #device.host if action == "on": device.set_power(True) elif action == "off": device.set_power(False) elif action == "status": print "on" if device.check_power() else "off"
Domoticz中触发命令:开关代码: 全选
script:///home/pi/domoticz/scripts/python/spmini.py on
代码: 全选
script:///home/pi/domoticz/scripts/python/spmini.py off
Traceback (most recent call last):
File "spmini.py", line 3, in
import broadlink
ImportError: No module named broadlink
是什么问题呢?