You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

31 lines
735 B

#!/usr/bin/env python
import sys, os
mydir = os.path.dirname(__file__)
sys.path.append(mydir)
sys.path.append(mydir + os.sep + 'include')
import config
from control import nec_control
action = sys.argv[1]
if not (action == "powerOn" or action == "powerOff"):
print("Syntax error")
print("Usage:")
print(" " + sys.argv[0] + " [ powerOn | powerOff ]")
sys.exit()
for i in config.displays:
try:
display = nec_control(i['address'], i['id'])
if action == "powerOn":
display.powerOn()
elif action == "powerOff":
display.powerOff()
del(display)
except:
print(i['address'] + ': Connection error')
else:
print(i['address'] + ': Success')