pysmarlaapi 0.9.1__tar.gz → 0.9.3__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.
Potentially problematic release.
This version of pysmarlaapi might be problematic. Click here for more details.
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/PKG-INFO +1 -1
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/__init__.py +1 -1
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/connection_hub/__init__.py +14 -6
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/LICENSE +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/README.md +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pyproject.toml +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/classes/__init__.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/classes/auth_token.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/classes/connection.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/__init__.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/classes/__init__.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/classes/property.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/classes/service.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/services/__init__.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/services/analyser_service.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/services/babywiege_service.py +0 -0
- {pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/services/info_service.py +0 -0
|
@@ -16,6 +16,10 @@ async def event_wait(event, timeout):
|
|
|
16
16
|
return
|
|
17
17
|
|
|
18
18
|
|
|
19
|
+
# suppress warnings from pysignalr (to avoid missing client method warnings)
|
|
20
|
+
logging.getLogger('pysignalr.client').setLevel(logging.ERROR)
|
|
21
|
+
|
|
22
|
+
|
|
19
23
|
class ConnectionHub:
|
|
20
24
|
"""SignalRCore Hub
|
|
21
25
|
Provides interface via websocket for the controller using the SignalRCore protocol.
|
|
@@ -33,13 +37,12 @@ class ConnectionHub:
|
|
|
33
37
|
self,
|
|
34
38
|
event_loop: asyncio.AbstractEventLoop,
|
|
35
39
|
connection: Connection,
|
|
36
|
-
|
|
37
|
-
backoff: int = 300,
|
|
40
|
+
max_delay: int = 256,
|
|
38
41
|
):
|
|
39
42
|
self.connection: Connection = connection
|
|
40
43
|
self._loop = event_loop
|
|
41
|
-
self.
|
|
42
|
-
self.
|
|
44
|
+
self._retry_delay = 1 # Initial connection retry delay
|
|
45
|
+
self._max_delay = max_delay
|
|
43
46
|
|
|
44
47
|
self.logger = logging.getLogger(f"{__package__}[{self.connection.token.serialNumber}]")
|
|
45
48
|
|
|
@@ -80,6 +83,7 @@ class ConnectionHub:
|
|
|
80
83
|
await listener(value)
|
|
81
84
|
|
|
82
85
|
async def on_open_function(self):
|
|
86
|
+
self._retry_delay = 1
|
|
83
87
|
self.logger.info("Connection to server established")
|
|
84
88
|
|
|
85
89
|
async def on_close_function(self):
|
|
@@ -110,10 +114,14 @@ class ConnectionHub:
|
|
|
110
114
|
self.logger.warning("Error during connection: %s: %s", type(e).__name__, str(e))
|
|
111
115
|
|
|
112
116
|
# Random backoff to avoid simultaneous connection attempts
|
|
113
|
-
|
|
114
|
-
await event_wait(self._wake, self.
|
|
117
|
+
jitter = random.uniform(0, 0.5) * self._retry_delay
|
|
118
|
+
await event_wait(self._wake, self._retry_delay + jitter)
|
|
115
119
|
self._wake.clear()
|
|
116
120
|
|
|
121
|
+
# Double the delay for the next attempt
|
|
122
|
+
if self._retry_delay < self._max_delay:
|
|
123
|
+
self._retry_delay *= 2
|
|
124
|
+
|
|
117
125
|
def wake_up(self):
|
|
118
126
|
self._wake.set()
|
|
119
127
|
|
|
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
|
{pysmarlaapi-0.9.1 → pysmarlaapi-0.9.3}/pysmarlaapi/federwiege/services/babywiege_service.py
RENAMED
|
File without changes
|
|
File without changes
|