pygaposa 0.2.0__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.
Files changed (33) hide show
  1. {pygaposa-0.2.0/pygaposa.egg-info → pygaposa-0.2.2}/PKG-INFO +1 -1
  2. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/__meta__.py +1 -1
  3. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/api_types.py +1 -1
  4. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/devicebase.py +2 -1
  5. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/poll_manager.py +16 -5
  6. {pygaposa-0.2.0 → pygaposa-0.2.2/pygaposa.egg-info}/PKG-INFO +1 -1
  7. {pygaposa-0.2.0 → pygaposa-0.2.2}/CHANGELOG.rst +0 -0
  8. {pygaposa-0.2.0 → pygaposa-0.2.2}/LICENSE +0 -0
  9. {pygaposa-0.2.0 → pygaposa-0.2.2}/MANIFEST.in +0 -0
  10. {pygaposa-0.2.0 → pygaposa-0.2.2}/README.rst +0 -0
  11. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/__init__.py +0 -0
  12. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/api.py +0 -0
  13. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/client.py +0 -0
  14. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/device.py +0 -0
  15. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/firebase.py +0 -0
  16. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/gaposa.py +0 -0
  17. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/geoapi.py +0 -0
  18. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/group.py +0 -0
  19. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/model.py +0 -0
  20. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/motor.py +0 -0
  21. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/room.py +0 -0
  22. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa/schedule.py +0 -0
  23. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa.egg-info/SOURCES.txt +0 -0
  24. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa.egg-info/dependency_links.txt +0 -0
  25. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa.egg-info/requires.txt +0 -0
  26. {pygaposa-0.2.0 → pygaposa-0.2.2}/pygaposa.egg-info/top_level.txt +0 -0
  27. {pygaposa-0.2.0 → pygaposa-0.2.2}/pyproject.toml +0 -0
  28. {pygaposa-0.2.0 → pygaposa-0.2.2}/requirements-dev.txt +0 -0
  29. {pygaposa-0.2.0 → pygaposa-0.2.2}/requirements-docs.txt +0 -0
  30. {pygaposa-0.2.0 → pygaposa-0.2.2}/requirements-test.txt +0 -0
  31. {pygaposa-0.2.0 → pygaposa-0.2.2}/requirements.txt +0 -0
  32. {pygaposa-0.2.0 → pygaposa-0.2.2}/setup.cfg +0 -0
  33. {pygaposa-0.2.0 → pygaposa-0.2.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pygaposa
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Unofficial module for access to Gaposa morotized shades cloud API
5
5
  Home-page: https://github.com/mwatson2/pygaposa
6
6
  Author: Mark Watson
@@ -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.0"
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"
@@ -164,7 +164,7 @@ class DeviceDocumentRequired(TypedDict):
164
164
  Groups: Dict[NumericIdentifier, GroupInfo]
165
165
  HeartBeat: HeartBeat
166
166
  DeletedChannels: List[int]
167
- Pending: list
167
+ Pending: list | Dict[str, Channel]
168
168
  Uid: list[str]
169
169
 
170
170
 
@@ -89,7 +89,8 @@ class DeviceBase(Updatable):
89
89
  self.uid = self.document["Uid"]
90
90
 
91
91
  for deletedChannel in self.document["DeletedChannels"]:
92
- del self.document["Channels"][str(deletedChannel)]
92
+ if str(deletedChannel) in self.document["Channels"]:
93
+ del self.document["Channels"][str(deletedChannel)]
93
94
 
94
95
  def setLocation(self, location: tuple[float, float], timezone: str):
95
96
  self.location = location
@@ -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 = 5
7
- POLL_TIMEOUT = 10 # seconds
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
- async def wait_for_condition(self, condition: Optional[Callable[[], bool]] = None):
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,11 +91,15 @@ 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")
90
- except Exception as e:
91
- self.logger.error(f"Error {e} waiting for device document update")
101
+ except Exception:
102
+ self.logger.exception("Error waiting for device document update")
92
103
 
93
104
  sleep = numConditions == self.numConditions()
94
105
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pygaposa
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Unofficial module for access to Gaposa morotized shades cloud API
5
5
  Home-page: https://github.com/mwatson2/pygaposa
6
6
  Author: Mark Watson
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