about summary refs log tree commit diff
path: root/cli/broadlink_cli
diff options
context:
space:
mode:
authorNightreaver <Nightreaver.b@googlemail.com>2018-03-18T22·03+0900
committerMatthew Garrett <mjg59-github@srcf.ucam.org>2018-03-18T22·03-0700
commit33a2e4ae54e996d37c814494f5da629fb5428f96 (patch)
treedfcb2fdac18cc31761e7d4d8afb059efc59ec64c /cli/broadlink_cli
parent39cc64efcea723cdc5e97220bd345535f558bb8f (diff)
implemented method to toggle nightlight on some SP3 devices (#159)
* implemented method to toggle nightlight on some SP3 devices

* implement nightlight feature to cli

* check_power/check_nightligh fixes for py2.7
Diffstat (limited to 'cli/broadlink_cli')
-rwxr-xr-xcli/broadlink_cli20
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/broadlink_cli b/cli/broadlink_cli
index 8d055f7019b8..4c0c5d7a723f 100755
--- a/cli/broadlink_cli
+++ b/cli/broadlink_cli
@@ -69,8 +69,11 @@ parser.add_argument("--host", help="host address")
 parser.add_argument("--mac", help="mac address (hex reverse), as used by python-broadlink library")
 parser.add_argument("--temperature",action="store_true", help="request temperature from device")
 parser.add_argument("--check", action="store_true", help="check current power state")
+parser.add_argument("--checknl", action="store_true", help="check current nightlight 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("--turnnlon", action="store_true", help="turn on nightlight on the device")
+parser.add_argument("--turnnloff", action="store_true", help="turn off nightlight on the 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")
@@ -139,6 +142,11 @@ if args.check:
         print '* ON *'
     else:
         print '* OFF *'
+if args.checknl:
+    if dev.check_nightlight():
+        print '* ON *'
+    else:
+        print '* OFF *'
 if args.turnon:
     dev.set_power(True)
     if dev.check_power():
@@ -151,6 +159,18 @@ if args.turnoff:
         print '!! Still ON !!'
     else:
         print '== Turned * OFF * =='
+if args.turnnlon:
+    dev.set_nightlight(True)
+    if dev.check_nightlight():
+        print '== Turned * ON * =='
+    else:
+        print '!! Still OFF !!'
+if args.turnnloff:
+    dev.set_nightlight(False)
+    if dev.check_nightlight():
+        print '!! Still ON !!'
+    else:
+        print '== Turned * OFF * =='
 if args.switch:
     if dev.check_power():
         dev.set_power(False)