30
30
create_session , merge_dicts , get_time , BlinkURLHandler ,
31
31
BlinkAuthenticationException , Throttle )
32
32
from blinkpy .helpers .constants import (
33
- BLINK_URL , LOGIN_URL , OLD_LOGIN_URL , LOGIN_BACKUP_URL )
33
+ BLINK_URL , LOGIN_URL , OLD_LOGIN_URL , LOGIN_BACKUP_URL ,
34
+ DEFAULT_MOTION_INTERVAL , DEFAULT_REFRESH , MIN_THROTTLE_TIME )
34
35
from blinkpy .helpers .constants import __version__
35
36
36
- REFRESH_RATE = 30
37
-
38
- # Prevents rapid calls to blink.refresh()
39
- # with the force_cache flag set to True
40
- MIN_THROTTLE_TIME = 2
41
37
42
38
_LOGGER = logging .getLogger (__name__ )
43
39
@@ -46,14 +42,19 @@ class Blink():
46
42
"""Class to initialize communication."""
47
43
48
44
def __init__ (self , username = None , password = None ,
49
- refresh_rate = REFRESH_RATE ):
45
+ refresh_rate = DEFAULT_REFRESH ,
46
+ motion_interval = DEFAULT_MOTION_INTERVAL ):
50
47
"""
51
48
Initialize Blink system.
52
49
53
50
:param username: Blink username (usually email address)
54
51
:param password: Blink password
55
52
:param refresh_rate: Refresh rate of blink information.
56
53
Defaults to 15 (seconds)
54
+ :param motion_interval: How far back to register motion in minutes.
55
+ Defaults to last refresh time.
56
+ Useful for preventing motion_detected property
57
+ from de-asserting too quickly.
57
58
"""
58
59
self ._username = username
59
60
self ._password = password
@@ -73,6 +74,7 @@ def __init__(self, username=None, password=None,
73
74
self .cameras = CaseInsensitiveDict ({})
74
75
self .video_list = CaseInsensitiveDict ({})
75
76
self ._login_url = LOGIN_URL
77
+ self .motion_interval = DEFAULT_MOTION_INTERVAL
76
78
self .version = __version__
77
79
78
80
@property
0 commit comments