diff --git a/cli/broadlink_cli b/cli/broadlink_cli index 097a7afbd..8d055f701 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 *'