about summary refs log tree commit diff
path: root/cli/broadlink_cli
diff options
context:
space:
mode:
authorIvan Martinez <ivanfmartinez@users.noreply.github.com>2017-04-16T14·34-0300
committerMatthew Garrett <mjg59-github@srcf.ucam.org>2017-04-22T19·42-0700
commit5195856200587cc087e7af52db55e1e559e083bf (patch)
treef460532595272f52d9f8120ac619739bcb22cad5 /cli/broadlink_cli
parentde7c5c2a2af68b88aff982d7a1fec5b3dcfd7d3b (diff)
included sensors option
Diffstat (limited to 'cli/broadlink_cli')
-rwxr-xr-xcli/broadlink_cli11
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/broadlink_cli b/cli/broadlink_cli
index 0dc6db66170b..c99a5260479b 100755
--- a/cli/broadlink_cli
+++ b/cli/broadlink_cli
@@ -15,6 +15,7 @@ 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("--send", help="send command")
+parser.add_argument("--sensors",action="store_true", help="check all sensors")
 parser.add_argument("--learn",action="store_true", help="learn command")
 parser.add_argument("--learnfile", help="learn command and save to specified file")
 args = parser.parse_args()
@@ -34,6 +35,14 @@ dev = broadlink.gendevice(type, (host, 80), mac)
 dev.auth()
 if args.temperature:
     print dev.check_temperature()
+if args.sensors:
+    try:
+        data = dev.check_sensors()
+    except:
+        data = {}
+        data['temperature'] =  dev.check_temperature()
+    for key in data:
+        print "{} {}".format(key, data[key])
 if args.send:
     data = bytearray.fromhex(args.send)
     dev.send_data(data)
@@ -56,4 +65,4 @@ if args.learn or args.learnfile:
                 text_file.write(learned)
     else:
         print "No data received..."
-            
\ No newline at end of file
+