Code: Select all
On Action:
script:///home/pi/domoticz/scripts/python/playcode2.py /home/pi/domoticz/scripts/python/lightOffice.txt
2016-12-11 12:56:15.310 User: Admin initiated a switch command (327/Light Office/On)
But nothing happen
When i give command in console:
root@raspberrypi:/# home/pi/domoticz/scripts/python/playcode2.py /home/pi/domoticz/scripts/python/lightOffice.txt
Connecting to Broadlink device....
Connected....
Code Sent....
Everything works
What's going on?
PS. After the reboot, everything works a few hours.
playcode2.py
Code: Select all
#!/usr/bin/python
import broadlink
import time
import sys
try:
fileName = sys.argv[1]
except IndexError:
fileName = 'null'
if fileName == 'null':
print "Error - no file name parameter suffixed"
sys.exit()
else:
device = broadlink.rm(host=("192.168.001.104",80), mac=bytearray.fromhex("B4430DF09A86"))
print "Connecting to Broadlink device...."
device.auth()
time.sleep(2)
print "Connected...."
#time.sleep(1)
device.host
file = open(fileName, 'r')
myhex = file.read()
device.send_data(myhex.decode('hex'))
print "Code Sent...."