Skip to content

Commit cb80bf7

Browse files
committed
Lots of time spent to get tox lint tests passing. Much cleaner code now.
1 parent 7bdba7c commit cb80bf7

13 files changed

+1127
-1001
lines changed

abodecl.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010
I am in no way affiliated with Blink, nor Immedia Inc.
1111
"""
1212

13-
import sys
1413
import argparse
14+
import sys
1515
import time
16-
import abodepy
1716

17+
import abodepy
1818
from helpers.constants import (ALL_MODES, ALL_MODES_STR)
1919

20+
2021
PARSER = argparse.ArgumentParser()
2122

2223
PARSER.add_argument('--username', help='Username', required=True)
@@ -26,7 +27,8 @@
2627
PARSER.add_argument('--arm', help='Arm Alarm To Mode', required=False)
2728
PARSER.add_argument('--devices', help='List All Devices',
2829
required=False, default=False, action="store_true")
29-
PARSER.add_argument('--device', help='Get Device', required=False, action='append')
30+
PARSER.add_argument('--device', help='Get Device',
31+
required=False, action='append')
3032
PARSER.add_argument('--listen', help='Listen For Device Updates',
3133
required=False, default=False, action="store_true")
3234
PARSER.add_argument('--debug', help='Output Debugging',
@@ -55,15 +57,22 @@
5557
else:
5658
print("Mode failed to change to: %s" % ARGS['arm'])
5759

60+
5861
def _device_print(dev, append=''):
59-
print("Device Name: %s, Device ID: %s, Device Type: %s, Device Status: %s%s" % (
60-
dev.name, dev.device_id, dev.type, dev.status, append))
62+
print("Device Name: %s, ID: %s, Type: %s, Status: %s%s" % (
63+
dev.name, dev.device_id, dev.type, dev.status, append))
64+
6165

6266
# Print out all devices.
6367
if ARGS['devices']:
6468
for device in ABODE.get_devices():
6569
_device_print(device)
6670

71+
72+
def _device_callback(dev):
73+
_device_print(dev, ", At: " + time.strftime("%Y-%m-%d %H:%M:%S"))
74+
75+
6776
# Print out specific devices by device id.
6877
if ARGS['device']:
6978
for device_id in ARGS['device']:
@@ -77,9 +86,6 @@ def _device_print(dev, append=''):
7786
else:
7887
print("Could not find device with id: %s" % device_id)
7988

80-
def _device_callback(dev):
81-
_device_print(dev, ", At: " + time.strftime("%Y-%m-%d %H:%M:%S"))
82-
8389
# Start device change listener.
8490
if ARGS['listen']:
8591
# If no devices were specified then we listen to all devices.

0 commit comments

Comments
 (0)