|
17 | 17 | import logging
|
18 | 18 | import datetime
|
19 | 19 | import aiofiles
|
| 20 | +import aiofiles.ospath |
20 | 21 | from requests.structures import CaseInsensitiveDict
|
21 | 22 | from dateutil.parser import parse
|
22 | 23 | from slugify import slugify
|
@@ -143,6 +144,8 @@ async def setup_prompt_2fa(self):
|
143 | 144 | async def setup_post_verify(self):
|
144 | 145 | """Initialize blink system after verification."""
|
145 | 146 | try:
|
| 147 | + if not self.homescreen: |
| 148 | + await self.get_homescreen() |
146 | 149 | await self.setup_networks()
|
147 | 150 | networks = self.setup_network_ids()
|
148 | 151 | cameras = await self.setup_camera_list()
|
@@ -191,7 +194,7 @@ async def setup_owls(self):
|
191 | 194 | network_list.append(str(network_id))
|
192 | 195 | self.sync[name] = BlinkOwl(self, name, network_id, owl)
|
193 | 196 | await self.sync[name].start()
|
194 |
| - except KeyError: |
| 197 | + except (KeyError, TypeError): |
195 | 198 | # No sync-less devices found
|
196 | 199 | pass
|
197 | 200 |
|
@@ -221,7 +224,7 @@ async def setup_lotus(self):
|
221 | 224 | network_list.append(str(network_id))
|
222 | 225 | self.sync[name] = BlinkLotus(self, name, network_id, lotus)
|
223 | 226 | await self.sync[name].start()
|
224 |
| - except KeyError: |
| 227 | + except (KeyError, TypeError): |
225 | 228 | # No sync-less devices found
|
226 | 229 | pass
|
227 | 230 |
|
@@ -317,6 +320,21 @@ async def save(self, file_name):
|
317 | 320 | """Save login data to file."""
|
318 | 321 | await util.json_save(self.auth.login_attributes, file_name)
|
319 | 322 |
|
| 323 | + async def get_status(self): |
| 324 | + """Get the blink system notification status.""" |
| 325 | + response = await api.request_notification_flags(self) |
| 326 | + return response.get("notifications", response) |
| 327 | + |
| 328 | + async def set_status(self, data_dict={}): |
| 329 | + """ |
| 330 | + Set the blink system notification status. |
| 331 | +
|
| 332 | + :param data_dict: Dictionary of notification keys to modify. |
| 333 | + Example: {'low_battery': False, 'motion': False} |
| 334 | + """ |
| 335 | + response = await api.request_set_notification_flag(self, data_dict) |
| 336 | + return response |
| 337 | + |
320 | 338 | async def download_videos(
|
321 | 339 | self, path, since=None, camera="all", stop=10, delay=1, debug=False
|
322 | 340 | ):
|
|
0 commit comments