RMpro已经添加并且设置完成,准备添加另一台RMmini,前面的工作没做,直接新建paly-RMmini.py,测试不成功,提示broadlink未定义。这是什么情况呀?
附设置:paly-RMmini.py
import sys
try:
fileName = sys.argv[1]
except IndexError:
fileName = 'null'
if fileName == 'null':
print "错误:参数中缺少编码文件"
sys.exit()
else:
device = broadlink.rm(host=("192.168.2.169",80), mac=bytearray.fromhex("b4430dcc4a4c"))
print "连接到博联设备...."
device.auth()
time.sleep(1)
print "已连接...."
time.sleep(1)
device.host
file = open(fileName, 'r')
myhex = file.read().strip()
device.send_data(myhex.decode('hex'))
print "编码已发送...."
运行后提示:
Traceback (most recent call last):
File "play-RMmini.py", line 10, in <module>
device = broadlink.rm(host=("192.168.2.169",80), mac=bytearray.fromhex("b4430dcc4a4c"))
NameError: name 'broadlink' is not defined
添加了RMpro后如何再添加RMmini
版面规则
博联Broadlink RM Pro/Mini、RM Home、MP1、MP2、SP mini等
博联Broadlink RM Pro/Mini、RM Home、MP1、MP2、SP mini等
Re: 添加了RMpro后如何再添加RMmini
没有 import broadlink
代码: 全选
import sys
import broadlink
try:
fileName = sys.argv[1]
......
Re: 添加了RMpro后如何再添加RMmini
按你的方法操作成功。
在SSH到树莓派后执行python play-RMmini.py S1000power.txt,设备可以正常控制。
导入到DOMOTICZ以后执行不成功,提示:
2017-06-03 14:04:38.111 2017-06-03 14:04:38.111 User: Admin initiated a switch command (47/S1000开关/Off)
2017-06-03 14:04:38.111 (漫步者S1000) Light/Switch (S1000开关)
2017-06-03 14:04:38.330 2017-06-03 14:04:38.330 Executing script: /home/pi/domoticz/scripts/python/play-RMmini.py
2017-06-03 14:04:38.349 2017-06-03 14:04:38.349 Error: Error executing script command (/home/pi/domoticz/scripts/python/play-RMmini.py). returned: 512
在SSH到树莓派后执行python play-RMmini.py S1000power.txt,设备可以正常控制。
导入到DOMOTICZ以后执行不成功,提示:
2017-06-03 14:04:38.111 2017-06-03 14:04:38.111 User: Admin initiated a switch command (47/S1000开关/Off)
2017-06-03 14:04:38.111 (漫步者S1000) Light/Switch (S1000开关)
2017-06-03 14:04:38.330 2017-06-03 14:04:38.330 Executing script: /home/pi/domoticz/scripts/python/play-RMmini.py
2017-06-03 14:04:38.349 2017-06-03 14:04:38.349 Error: Error executing script command (/home/pi/domoticz/scripts/python/play-RMmini.py). returned: 512
Re: 添加了RMpro后如何再添加RMmini
按你的方法操作成功。
在SSH到树莓派后执行python play-RMmini.py S1000power.txt,设备可以正常控制。
导入到DOMOTICZ以后执行不成功,提示:
2017-06-03 14:04:38.111 2017-06-03 14:04:38.111 User: Admin initiated a switch command (47/S1000开关/Off)
2017-06-03 14:04:38.111 (漫步者S1000) Light/Switch (S1000开关)
2017-06-03 14:04:38.330 2017-06-03 14:04:38.330 Executing script: /home/pi/domoticz/scripts/python/play-RMmini.py
2017-06-03 14:04:38.349 2017-06-03 14:04:38.349 Error: Error executing script command (/home/pi/domoticz/scripts/python/play-RMmini.py). returned: 512
Re: 添加了RMpro后如何再添加RMmini
ssh执行Naro 写了: ↑周六 6月 03, 2017 14:07
按你的方法操作成功。
在SSH到树莓派后执行python play-RMmini.py S1000power.txt,设备可以正常控制。
导入到DOMOTICZ以后执行不成功,提示:
2017-06-03 14:04:38.111 2017-06-03 14:04:38.111 User: Admin initiated a switch command (47/S1000开关/Off)
2017-06-03 14:04:38.111 (漫步者S1000) Light/Switch (S1000开关)
2017-06-03 14:04:38.330 2017-06-03 14:04:38.330 Executing script: /home/pi/domoticz/scripts/python/play-RMmini.py
2017-06-03 14:04:38.349 2017-06-03 14:04:38.349 Error: Error executing script command (/home/pi/domoticz/scripts/python/play-RMmini.py). returned: 512
代码: 全选
sudo chmod +x /home/pi/domoticz/scripts/python/play-RMmini.py
Re: 添加了RMpro后如何再添加RMmini
DT27 写了: ↑周六 6月 03, 2017 15:24ssh执行Naro 写了: ↑周六 6月 03, 2017 14:07
按你的方法操作成功。
在SSH到树莓派后执行python play-RMmini.py S1000power.txt,设备可以正常控制。
导入到DOMOTICZ以后执行不成功,提示:
2017-06-03 14:04:38.111 2017-06-03 14:04:38.111 User: Admin initiated a switch command (47/S1000开关/Off)
2017-06-03 14:04:38.111 (漫步者S1000) Light/Switch (S1000开关)
2017-06-03 14:04:38.330 2017-06-03 14:04:38.330 Executing script: /home/pi/domoticz/scripts/python/play-RMmini.py
2017-06-03 14:04:38.349 2017-06-03 14:04:38.349 Error: Error executing script command (/home/pi/domoticz/scripts/python/play-RMmini.py). returned: 512再试试,S1000power.txt路径也要写全。代码: 全选
sudo chmod +x /home/pi/domoticz/scripts/python/play-RMmini.py
忘记跟你说之前已经把PY的权限设置为777了。
仍旧没有解决。
附Domoticz中开关触发信息:
script:///home/pi/domoticz/scripts/python/play-RMmini.py /home/pi/domoticz/scripts/python/S1000power.txt
Re: 添加了RMpro后如何再添加RMmini
没招好像。。。奇葩问题Naro 写了: ↑周六 6月 03, 2017 18:56DT27 写了: ↑周六 6月 03, 2017 15:24ssh执行Naro 写了: ↑周六 6月 03, 2017 14:07
按你的方法操作成功。
在SSH到树莓派后执行python play-RMmini.py S1000power.txt,设备可以正常控制。
导入到DOMOTICZ以后执行不成功,提示:
2017-06-03 14:04:38.111 2017-06-03 14:04:38.111 User: Admin initiated a switch command (47/S1000开关/Off)
2017-06-03 14:04:38.111 (漫步者S1000) Light/Switch (S1000开关)
2017-06-03 14:04:38.330 2017-06-03 14:04:38.330 Executing script: /home/pi/domoticz/scripts/python/play-RMmini.py
2017-06-03 14:04:38.349 2017-06-03 14:04:38.349 Error: Error executing script command (/home/pi/domoticz/scripts/python/play-RMmini.py). returned: 512再试试,S1000power.txt路径也要写全。代码: 全选
sudo chmod +x /home/pi/domoticz/scripts/python/play-RMmini.py
忘记跟你说之前已经把PY的权限设置为777了。
仍旧没有解决。
附Domoticz中开关触发信息:
script:///home/pi/domoticz/scripts/python/play-RMmini.py /home/pi/domoticz/scripts/python/S1000power.txt
-
- 帖子: 1
- 注册时间: 周一 10月 30, 2017 15:28
Re: 添加了RMpro后如何再添加RMmini
试试看script:///usr/bin/python3.4 /home/pi/domoticz/scripts/python/play-RMmini.py /home/pi/domoticz/scripts/python/S1000power.txt
-
- 帖子: 98
- 注册时间: 周四 3月 30, 2017 00:03
Re: 添加了RMpro后如何再添加RMmini
直接写进lua吧 scripts://总归这样那样奇怪的问题