From f8c91234b2d7fd05efb02a1fcc463430927839f0 Mon Sep 17 00:00:00 2001 From: mkmer Date: Mon, 6 Nov 2023 20:55:16 +0000 Subject: [PATCH 1/4] Speed up arm state determination --- blinkpy/sync_module.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/blinkpy/sync_module.py b/blinkpy/sync_module.py index ea1fcfb8..9084991e 100644 --- a/blinkpy/sync_module.py +++ b/blinkpy/sync_module.py @@ -109,7 +109,9 @@ def local_storage_manifest_ready(self): async def async_arm(self, value): """Arm or disarm camera.""" if value: + self.network_info["network"]["armed"] = True return await api.request_system_arm(self.blink, self.network_id) + self.network_info["network"]["armed"] = False return await api.request_system_disarm(self.blink, self.network_id) async def start(self): From 2b07d6224a23d93c7362e3cd35e4f8159569fb5b Mon Sep 17 00:00:00 2001 From: mkmer Date: Tue, 7 Nov 2023 19:49:45 +0000 Subject: [PATCH 2/4] Refactor async arm --- blinkpy/sync_module.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/blinkpy/sync_module.py b/blinkpy/sync_module.py index 9084991e..446c52af 100644 --- a/blinkpy/sync_module.py +++ b/blinkpy/sync_module.py @@ -109,11 +109,12 @@ def local_storage_manifest_ready(self): async def async_arm(self, value): """Arm or disarm camera.""" if value: - self.network_info["network"]["armed"] = True - return await api.request_system_arm(self.blink, self.network_id) - self.network_info["network"]["armed"] = False - return await api.request_system_disarm(self.blink, self.network_id) - + result = await api.request_system_arm(self.blink, self.network_id) + else: + result = await api.request_system_disarm(self.blink, self.network_id) + await self.get_network_info() + return result + async def start(self): """Initialize the system.""" _LOGGER.debug("Initializing the sync module") From 5359efbee29a4ec4603ea619e09551d0341b938a Mon Sep 17 00:00:00 2001 From: mkmer Date: Tue, 7 Nov 2023 19:52:13 +0000 Subject: [PATCH 3/4] Lint error --- blinkpy/sync_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blinkpy/sync_module.py b/blinkpy/sync_module.py index 446c52af..8764a23b 100644 --- a/blinkpy/sync_module.py +++ b/blinkpy/sync_module.py @@ -114,7 +114,7 @@ async def async_arm(self, value): result = await api.request_system_disarm(self.blink, self.network_id) await self.get_network_info() return result - + async def start(self): """Initialize the system.""" _LOGGER.debug("Initializing the sync module") From 0702f1b11e51b56c58c93ebdaf8bc8679dc26093 Mon Sep 17 00:00:00 2001 From: mkmer Date: Wed, 8 Nov 2023 18:43:10 +0000 Subject: [PATCH 4/4] Remove Throttle from refresh --- blinkpy/blinkpy.py | 1 - 1 file changed, 1 deletion(-) diff --git a/blinkpy/blinkpy.py b/blinkpy/blinkpy.py index 8bfa4566..c3d07f0e 100644 --- a/blinkpy/blinkpy.py +++ b/blinkpy/blinkpy.py @@ -79,7 +79,6 @@ def __init__( self.homescreen = {} self.no_owls = no_owls - @util.Throttle(seconds=MIN_THROTTLE_TIME) async def refresh(self, force=False, force_cache=False): """ Perform a system refresh.