10
10
I am in no way affiliated with Blink, nor Immedia Inc.
11
11
"""
12
12
13
- import sys
14
13
import argparse
14
+ import sys
15
15
import time
16
- import abodepy
17
16
17
+ import abodepy
18
18
from helpers .constants import (ALL_MODES , ALL_MODES_STR )
19
19
20
+
20
21
PARSER = argparse .ArgumentParser ()
21
22
22
23
PARSER .add_argument ('--username' , help = 'Username' , required = True )
26
27
PARSER .add_argument ('--arm' , help = 'Arm Alarm To Mode' , required = False )
27
28
PARSER .add_argument ('--devices' , help = 'List All Devices' ,
28
29
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' )
30
32
PARSER .add_argument ('--listen' , help = 'Listen For Device Updates' ,
31
33
required = False , default = False , action = "store_true" )
32
34
PARSER .add_argument ('--debug' , help = 'Output Debugging' ,
55
57
else :
56
58
print ("Mode failed to change to: %s" % ARGS ['arm' ])
57
59
60
+
58
61
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
+
61
65
62
66
# Print out all devices.
63
67
if ARGS ['devices' ]:
64
68
for device in ABODE .get_devices ():
65
69
_device_print (device )
66
70
71
+
72
+ def _device_callback (dev ):
73
+ _device_print (dev , ", At: " + time .strftime ("%Y-%m-%d %H:%M:%S" ))
74
+
75
+
67
76
# Print out specific devices by device id.
68
77
if ARGS ['device' ]:
69
78
for device_id in ARGS ['device' ]:
@@ -77,9 +86,6 @@ def _device_print(dev, append=''):
77
86
else :
78
87
print ("Could not find device with id: %s" % device_id )
79
88
80
- def _device_callback (dev ):
81
- _device_print (dev , ", At: " + time .strftime ("%Y-%m-%d %H:%M:%S" ))
82
-
83
89
# Start device change listener.
84
90
if ARGS ['listen' ]:
85
91
# If no devices were specified then we listen to all devices.
0 commit comments