about summary refs log tree commit diff
path: root/cli/broadlink_cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli/broadlink_cli')
-rwxr-xr-xcli/broadlink_cli8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/broadlink_cli b/cli/broadlink_cli
index 097a7afbdae7..8d055f7019b8 100755
--- a/cli/broadlink_cli
+++ b/cli/broadlink_cli
@@ -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 *'