pysmarlaapi 0.10.0__tar.gz → 0.10.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.
Potentially problematic release.
This version of pysmarlaapi might be problematic. Click here for more details.
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/PKG-INFO +1 -1
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/__init__.py +1 -1
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/connection_hub/__init__.py +1 -31
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/LICENSE +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/README.md +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pyproject.toml +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/classes/__init__.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/classes/auth_token.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/classes/connection.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/__init__.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/classes/__init__.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/classes/property.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/classes/service.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/__init__.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/analyser_service.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/babywiege_service.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/info_service.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/system_service.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/types/__init__.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/types/send_diag_status.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/types/spring_status.py +0 -0
- {pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/types/update_status.py +0 -0
|
@@ -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))
|
|
@@ -136,30 +128,8 @@ class ConnectionHub:
|
|
|
136
128
|
self._wake.set()
|
|
137
129
|
|
|
138
130
|
async def close_connection(self):
|
|
139
|
-
|
|
140
|
-
await self.client._transport._ws.close()
|
|
141
|
-
|
|
142
|
-
async def start_reconnect_job(self):
|
|
143
|
-
async with self._reconnect_lock:
|
|
144
|
-
if self._reconnect_future and not self._reconnect_future.done():
|
|
145
|
-
return
|
|
146
|
-
self._reconnect_cancel_event.clear()
|
|
147
|
-
self._reconnect_future = asyncio.create_task(self.reconnect_job())
|
|
148
|
-
|
|
149
|
-
async def cancel_reconnect_job(self):
|
|
150
|
-
async with self._reconnect_lock:
|
|
151
|
-
if not self._reconnect_future or self._reconnect_future.done():
|
|
152
|
-
return
|
|
153
|
-
self._reconnect_cancel_event.set()
|
|
154
|
-
await self._reconnect_future
|
|
155
|
-
|
|
156
|
-
async def reconnect_job(self):
|
|
157
|
-
cancelled = await event_wait(self._reconnect_cancel_event, self._forced_reconnect_interval)
|
|
158
|
-
if cancelled:
|
|
131
|
+
if not self.connected:
|
|
159
132
|
return
|
|
160
|
-
|
|
161
|
-
# Close connection to trigger a reconnection
|
|
162
|
-
# Make sure that connection stays healthy
|
|
163
133
|
await self.client._transport._ws.close()
|
|
164
134
|
|
|
165
135
|
async def refresh_token(self):
|
|
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.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/analyser_service.py
RENAMED
|
File without changes
|
{pysmarlaapi-0.10.0 → pysmarlaapi-0.10.2}/pysmarlaapi/federwiege/services/babywiege_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|