Skip to content

Commit 1765584

Browse files
authored
Merge pull request #305 from fronzbot/disable-owl-option
Add option to skip homescreen check
2 parents 382db80 + d9e3761 commit 1765584

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

blinkpy/blinkpy.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class Blink:
4040
"""Class to initialize communication."""
4141

4242
def __init__(
43-
self, refresh_rate=DEFAULT_REFRESH, motion_interval=DEFAULT_MOTION_INTERVAL,
43+
self,
44+
refresh_rate=DEFAULT_REFRESH,
45+
motion_interval=DEFAULT_MOTION_INTERVAL,
46+
no_owls=False,
4447
):
4548
"""
4649
Initialize Blink system.
@@ -51,6 +54,7 @@ def __init__(
5154
Defaults to last refresh time.
5255
Useful for preventing motion_detected property
5356
from de-asserting too quickly.
57+
:param no_owls: Disable searching for owl entries (blink mini cameras only known entity). Prevents an uneccessary API call if you don't have these in your network.
5458
"""
5559
self.auth = Auth()
5660
self.account_id = None
@@ -68,6 +72,7 @@ def __init__(
6872
self.available = False
6973
self.key_required = False
7074
self.homescreen = {}
75+
self.no_owls = no_owls
7176

7277
@util.Throttle(seconds=MIN_THROTTLE_TIME)
7378
def refresh(self, force=False):
@@ -141,6 +146,9 @@ def setup_sync_module(self, name, network_id, cameras):
141146

142147
def setup_owls(self):
143148
"""Check for mini cameras."""
149+
if self.no_owls:
150+
_LOGGER.debug("Skipping owl extraction.")
151+
return []
144152
response = api.request_homescreen(self)
145153
self.homescreen = response
146154
network_list = []

tests/test_blinkpy.py

+6
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,12 @@ def test_blink_mini_cameras_returned(self, mock_home):
259259
result, [{"1234": {"name": "foo", "id": "1234", "type": "mini"}}]
260260
)
261261

262+
self.blink.no_owls = True
263+
self.blink.network_ids = []
264+
result = self.blink.setup_owls()
265+
self.assertEqual(self.blink.network_ids, [])
266+
self.assertEqual(result, [])
267+
262268
@mock.patch("blinkpy.api.request_homescreen")
263269
@mock.patch("blinkpy.api.request_camera_usage")
264270
def test_blink_mini_attached_to_sync(self, mock_usage, mock_home):

0 commit comments

Comments
 (0)