pysmarlaapi 0.10.1__py3-none-any.whl → 0.10.2__py3-none-any.whl
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/__init__.py +1 -1
- pysmarlaapi/connection_hub/__init__.py +0 -32
- {pysmarlaapi-0.10.1.dist-info → pysmarlaapi-0.10.2.dist-info}/METADATA +1 -1
- {pysmarlaapi-0.10.1.dist-info → pysmarlaapi-0.10.2.dist-info}/RECORD +6 -6
- {pysmarlaapi-0.10.1.dist-info → pysmarlaapi-0.10.2.dist-info}/WHEEL +0 -0
- {pysmarlaapi-0.10.1.dist-info → pysmarlaapi-0.10.2.dist-info}/licenses/LICENSE +0 -0
pysmarlaapi/__init__.py
CHANGED
|
@@ -39,13 +39,11 @@ class ConnectionHub:
|
|
|
39
39
|
event_loop: asyncio.AbstractEventLoop,
|
|
40
40
|
connection: Connection,
|
|
41
41
|
max_delay: int = 256,
|
|
42
|
-
forced_reconnect_interval: int = 86400,
|
|
43
42
|
):
|
|
44
43
|
self.connection: Connection = connection
|
|
45
44
|
self._loop = event_loop
|
|
46
45
|
self._retry_delay = 1 # Initial connection retry delay
|
|
47
46
|
self._max_delay = max_delay
|
|
48
|
-
self._forced_reconnect_interval = forced_reconnect_interval
|
|
49
47
|
|
|
50
48
|
self.logger = logging.getLogger(f"{__package__}[{self.connection.token.serialNumber}]")
|
|
51
49
|
|
|
@@ -54,10 +52,6 @@ class ConnectionHub:
|
|
|
54
52
|
self._running = False
|
|
55
53
|
self._wake = asyncio.Event()
|
|
56
54
|
|
|
57
|
-
self._reconnect_future: asyncio.Future = None
|
|
58
|
-
self._reconnect_lock = asyncio.Lock()
|
|
59
|
-
self._reconnect_cancel_event = asyncio.Event()
|
|
60
|
-
|
|
61
55
|
self.client = None
|
|
62
56
|
self.setup()
|
|
63
57
|
|
|
@@ -92,11 +86,9 @@ class ConnectionHub:
|
|
|
92
86
|
async def on_open_function(self):
|
|
93
87
|
self._retry_delay = 1
|
|
94
88
|
self.logger.info("Connection to server established")
|
|
95
|
-
await self.start_reconnect_job()
|
|
96
89
|
|
|
97
90
|
async def on_close_function(self):
|
|
98
91
|
self.logger.info("Connection to server closed")
|
|
99
|
-
await self.cancel_reconnect_job()
|
|
100
92
|
|
|
101
93
|
async def on_error(self, message):
|
|
102
94
|
self.logger.error("Connection error occurred: %s", str(message))
|
|
@@ -138,30 +130,6 @@ class ConnectionHub:
|
|
|
138
130
|
async def close_connection(self):
|
|
139
131
|
if not self.connected:
|
|
140
132
|
return
|
|
141
|
-
await self.cancel_reconnect_job()
|
|
142
|
-
await self.client._transport._ws.close()
|
|
143
|
-
|
|
144
|
-
async def start_reconnect_job(self):
|
|
145
|
-
async with self._reconnect_lock:
|
|
146
|
-
if self._reconnect_future and not self._reconnect_future.done():
|
|
147
|
-
return
|
|
148
|
-
self._reconnect_cancel_event.clear()
|
|
149
|
-
self._reconnect_future = asyncio.create_task(self.reconnect_job())
|
|
150
|
-
|
|
151
|
-
async def cancel_reconnect_job(self):
|
|
152
|
-
async with self._reconnect_lock:
|
|
153
|
-
if not self._reconnect_future or self._reconnect_future.done():
|
|
154
|
-
return
|
|
155
|
-
self._reconnect_cancel_event.set()
|
|
156
|
-
await self._reconnect_future
|
|
157
|
-
|
|
158
|
-
async def reconnect_job(self):
|
|
159
|
-
cancelled = await event_wait(self._reconnect_cancel_event, self._forced_reconnect_interval)
|
|
160
|
-
if cancelled:
|
|
161
|
-
return
|
|
162
|
-
|
|
163
|
-
# Close connection to trigger a reconnection
|
|
164
|
-
# Make sure that connection stays healthy
|
|
165
133
|
await self.client._transport._ws.close()
|
|
166
134
|
|
|
167
135
|
async def refresh_token(self):
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
pysmarlaapi/__init__.py,sha256=
|
|
1
|
+
pysmarlaapi/__init__.py,sha256=CKsioEmpvDTxuPK7U0PkysHMGnXtKybXInmhtOWqZjA,91
|
|
2
2
|
pysmarlaapi/classes/__init__.py,sha256=N-ZV3Id_t5ciovUlPUGCk5SLLiMUonRoQZWpfOU4ZsM,69
|
|
3
3
|
pysmarlaapi/classes/auth_token.py,sha256=dpo0lBT9Advm3Iyxu-fT9sq078U2OxgXXBuF5gbBZkM,942
|
|
4
4
|
pysmarlaapi/classes/connection.py,sha256=vVC0Ur0KQUb4pNDVuCYnfk-JXs-O-FwYVO-2y1E2g6g,1551
|
|
5
|
-
pysmarlaapi/connection_hub/__init__.py,sha256=
|
|
5
|
+
pysmarlaapi/connection_hub/__init__.py,sha256=qmoq94Pl0E87Ni_d5L3PqFra2z40a_uZupqmX9eDNAs,4844
|
|
6
6
|
pysmarlaapi/federwiege/__init__.py,sha256=P3hpgf-okQDEpwCUiLHn1acnenURUorEDVFya9Dvk6M,2020
|
|
7
7
|
pysmarlaapi/federwiege/classes/__init__.py,sha256=DFJJVOKpra40S4ZX_oq2RyMazg6Nx0c8hoPggmj1bXA,60
|
|
8
8
|
pysmarlaapi/federwiege/classes/property.py,sha256=S5Zzo9cXDJMFcQG1vCw1eO-oqeSpQs2YjxWouN_KRkU,1032
|
|
@@ -16,7 +16,7 @@ pysmarlaapi/federwiege/types/__init__.py,sha256=XWB_IrNYbIyQjyR_oKAOvHAjGGRLSQqZ
|
|
|
16
16
|
pysmarlaapi/federwiege/types/send_diag_status.py,sha256=hxpfNQmZs1YOztxLVnN3Bu50fXwf-hfV6K8GiQlBvkk,120
|
|
17
17
|
pysmarlaapi/federwiege/types/spring_status.py,sha256=cJsWFf2ZG-NvnT3l_CxVJfMFB3Ruv_juTy7Lpb-YEsA,227
|
|
18
18
|
pysmarlaapi/federwiege/types/update_status.py,sha256=YkajOEJ09pY9u4EBxw8ePEjPjYOLdK0i2l41cXbjb8Y,123
|
|
19
|
-
pysmarlaapi-0.10.
|
|
20
|
-
pysmarlaapi-0.10.
|
|
21
|
-
pysmarlaapi-0.10.
|
|
22
|
-
pysmarlaapi-0.10.
|
|
19
|
+
pysmarlaapi-0.10.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
20
|
+
pysmarlaapi-0.10.2.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
21
|
+
pysmarlaapi-0.10.2.dist-info/METADATA,sha256=pz4Rij3qwc5ydyu7j4qL1s_LU0dP-oaCreB9uEoGfKA,1104
|
|
22
|
+
pysmarlaapi-0.10.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|