mirror of
https://github.com/mjg59/python-broadlink.git
synced 2024-11-22 07:00:12 +01:00
Add option to switch state (#160)
Find lacking for an option in one line to switch a state of SP2 switches
This commit is contained in:
parent
26109aac67
commit
21d96bd140
@ -71,6 +71,7 @@ parser.add_argument("--temperature",action="store_true", help="request temperatu
|
||||
parser.add_argument("--check", action="store_true", help="check current power state")
|
||||
parser.add_argument("--turnon", action="store_true", help="turn on device")
|
||||
parser.add_argument("--turnoff", action="store_true", help="turn off device")
|
||||
parser.add_argument("--switch", action="store_true", help="switch state from on to off and off to on")
|
||||
parser.add_argument("--send", action="store_true", help="send command")
|
||||
parser.add_argument("--sensors", action="store_true", help="check all sensors")
|
||||
parser.add_argument("--learn", action="store_true", help="learn command")
|
||||
@ -150,3 +151,10 @@ if args.turnoff:
|
||||
print '!! Still ON !!'
|
||||
else:
|
||||
print '== Turned * OFF * =='
|
||||
if args.switch:
|
||||
if dev.check_power():
|
||||
dev.set_power(False)
|
||||
print '* Switch to OFF *'
|
||||
else:
|
||||
dev.set_power(True)
|
||||
print '* Switch to ON *'
|
||||
|
Loading…
Reference in New Issue
Block a user