pygaposa 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pygaposa-0.2.1/pygaposa.egg-info → pygaposa-0.2.2}/PKG-INFO +1 -1
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/__meta__.py +1 -1
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/poll_manager.py +14 -3
- {pygaposa-0.2.1 → pygaposa-0.2.2/pygaposa.egg-info}/PKG-INFO +1 -1
- {pygaposa-0.2.1 → pygaposa-0.2.2}/CHANGELOG.rst +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/LICENSE +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/MANIFEST.in +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/README.rst +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/__init__.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/api.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/api_types.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/client.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/device.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/devicebase.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/firebase.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/gaposa.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/geoapi.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/group.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/model.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/motor.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/room.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa/schedule.py +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa.egg-info/SOURCES.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa.egg-info/dependency_links.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa.egg-info/requires.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pygaposa.egg-info/top_level.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/pyproject.toml +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/requirements-dev.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/requirements-docs.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/requirements-test.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/requirements.txt +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/setup.cfg +0 -0
- {pygaposa-0.2.1 → pygaposa-0.2.2}/setup.py +0 -0
|
@@ -4,7 +4,7 @@ name = "pygaposa"
|
|
|
4
4
|
path = name.lower().replace("-", "_").replace(" ", "_")
|
|
5
5
|
# Your version number should follow https://python.org/dev/peps/pep-0440 and
|
|
6
6
|
# https://semver.org
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.2"
|
|
8
8
|
author = "Mark Watson"
|
|
9
9
|
author_email = "markwatson@cantab.net"
|
|
10
10
|
description = "Unofficial module for access to Gaposa morotized shades cloud API"
|
|
@@ -3,8 +3,8 @@ from logging import Logger
|
|
|
3
3
|
from typing import Any, Callable, Coroutine, Optional, TypedDict
|
|
4
4
|
|
|
5
5
|
POLL_INTERVAL = 2 # seconds
|
|
6
|
-
POLL_RETRIES =
|
|
7
|
-
POLL_TIMEOUT =
|
|
6
|
+
POLL_RETRIES = 10
|
|
7
|
+
POLL_TIMEOUT = 20 # seconds
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class PollMagagerConfig(TypedDict):
|
|
@@ -64,7 +64,7 @@ class PollManager:
|
|
|
64
64
|
"""
|
|
65
65
|
await self.wait_for_condition()
|
|
66
66
|
|
|
67
|
-
|
|
67
|
+
def add_condition(self, condition: Optional[Callable[[], bool]] = None):
|
|
68
68
|
"""
|
|
69
69
|
Poll the device document until the callback returns True or just once.
|
|
70
70
|
"""
|
|
@@ -75,6 +75,13 @@ class PollManager:
|
|
|
75
75
|
if self.pollingTask is None:
|
|
76
76
|
self.pollingTask = asyncio.create_task(self.execute())
|
|
77
77
|
|
|
78
|
+
return event
|
|
79
|
+
|
|
80
|
+
async def wait_for_condition(self, condition: Optional[Callable[[], bool]] = None):
|
|
81
|
+
"""
|
|
82
|
+
Poll the device document until the callback returns True or just once.
|
|
83
|
+
"""
|
|
84
|
+
event = self.add_condition(condition)
|
|
78
85
|
await event.wait()
|
|
79
86
|
|
|
80
87
|
async def execute(self):
|
|
@@ -84,6 +91,10 @@ class PollManager:
|
|
|
84
91
|
while self.waiters:
|
|
85
92
|
numConditions = self.numConditions()
|
|
86
93
|
try:
|
|
94
|
+
self.logger.debug(
|
|
95
|
+
f"Polling device document ({numConditions} conditions,"
|
|
96
|
+
f" {self.retries} retries)"
|
|
97
|
+
)
|
|
87
98
|
await asyncio.wait_for(self.poll(), self.poll_timeout)
|
|
88
99
|
except asyncio.TimeoutError:
|
|
89
100
|
self.logger.error("Timeout waiting for device document update")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|