pyhive-integration 1.0.8.dev7__tar.gz → 1.0.8.dev8__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.
- {pyhive_integration-1.0.8.dev7/pyhive_integration.egg-info → pyhive_integration-1.0.8.dev8}/PKG-INFO +1 -1
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8/pyhive_integration.egg-info}/PKG-INFO +1 -1
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/setup.py +1 -1
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/session.py +63 -10
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/LICENSE +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/MANIFEST.in +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/README.md +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/pyhive_integration.egg-info/SOURCES.txt +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/pyhive_integration.egg-info/dependency_links.txt +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/pyhive_integration.egg-info/requires.txt +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/pyhive_integration.egg-info/top_level.txt +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/pyproject.toml +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/requirements.txt +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/requirements_test.txt +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/setup.cfg +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/__init__.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/action.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/alarm.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/api/__init__.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/api/hive_api.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/api/hive_async_api.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/api/hive_auth.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/api/hive_auth_async.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/camera.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/device_attributes.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/heating.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/__init__.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/const.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/debugger.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/hive_exceptions.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/hive_helper.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/hivedataclasses.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/map.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/hive.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/hotwater.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/hub.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/light.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/plug.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/sensor.py +0 -0
- {pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/tests/test_hub.py +0 -0
|
@@ -17,7 +17,7 @@ def requirements_from_file(filename="requirements.txt"):
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
setup(
|
|
20
|
-
version="1.0.8.
|
|
20
|
+
version="1.0.8.dev8",
|
|
21
21
|
packages=["apyhiveapi", "apyhiveapi.api", "apyhiveapi.helper"],
|
|
22
22
|
package_dir={"apyhiveapi": "src"},
|
|
23
23
|
package_data={"data": ["*.json"]},
|
|
@@ -108,6 +108,7 @@ class HiveSession:
|
|
|
108
108
|
self.deviceList = {}
|
|
109
109
|
self.hub_id = None
|
|
110
110
|
self._lastPollSlow = False
|
|
111
|
+
self._slowPollThreshold = timedelta(seconds=3)
|
|
111
112
|
|
|
112
113
|
def openFile(self, file: str):
|
|
113
114
|
"""Open a file.
|
|
@@ -226,6 +227,29 @@ class HiveSession:
|
|
|
226
227
|
if "ExpiresIn" in data:
|
|
227
228
|
self.tokens.tokenExpiry = timedelta(seconds=data["ExpiresIn"])
|
|
228
229
|
|
|
230
|
+
_LOGGER.debug(
|
|
231
|
+
"updateTokens — IdToken: len=%d tail=…%s | "
|
|
232
|
+
"AccessToken: len=%d tail=…%s | "
|
|
233
|
+
"RefreshToken: %s | "
|
|
234
|
+
"ExpiresIn: %s | tokenCreated: %s | tokenExpiry: %s",
|
|
235
|
+
len(self.tokens.tokenData.get("token", "")),
|
|
236
|
+
self.tokens.tokenData.get("token", "")[-4:],
|
|
237
|
+
len(self.tokens.tokenData.get("accessToken", "")),
|
|
238
|
+
self.tokens.tokenData.get("accessToken", "")[-4:],
|
|
239
|
+
(
|
|
240
|
+
"present (len=%d tail=…%s)"
|
|
241
|
+
% (
|
|
242
|
+
len(self.tokens.tokenData.get("refreshToken", "")),
|
|
243
|
+
self.tokens.tokenData.get("refreshToken", "")[-4:],
|
|
244
|
+
)
|
|
245
|
+
if self.tokens.tokenData.get("refreshToken")
|
|
246
|
+
else "not present"
|
|
247
|
+
),
|
|
248
|
+
data.get("ExpiresIn", "N/A"),
|
|
249
|
+
self.tokens.tokenCreated,
|
|
250
|
+
self.tokens.tokenExpiry,
|
|
251
|
+
)
|
|
252
|
+
|
|
229
253
|
return self.tokens
|
|
230
254
|
|
|
231
255
|
async def login(self):
|
|
@@ -255,7 +279,8 @@ class HiveSession:
|
|
|
255
279
|
raise
|
|
256
280
|
|
|
257
281
|
if result and "AuthenticationResult" in result:
|
|
258
|
-
|
|
282
|
+
auth_keys = list(result["AuthenticationResult"].keys())
|
|
283
|
+
_LOGGER.debug("Login successful — AuthenticationResult keys: %s", auth_keys)
|
|
259
284
|
await self.updateTokens(result)
|
|
260
285
|
return result
|
|
261
286
|
|
|
@@ -284,7 +309,10 @@ class HiveSession:
|
|
|
284
309
|
raise
|
|
285
310
|
|
|
286
311
|
if result and "AuthenticationResult" in result:
|
|
287
|
-
|
|
312
|
+
auth_keys = list(result["AuthenticationResult"].keys())
|
|
313
|
+
_LOGGER.debug(
|
|
314
|
+
"2FA login successful — AuthenticationResult keys: %s", auth_keys
|
|
315
|
+
)
|
|
288
316
|
await self.updateTokens(result)
|
|
289
317
|
return result
|
|
290
318
|
|
|
@@ -311,9 +339,11 @@ class HiveSession:
|
|
|
311
339
|
raise
|
|
312
340
|
|
|
313
341
|
if result and "AuthenticationResult" in result:
|
|
314
|
-
|
|
342
|
+
auth_keys = list(result["AuthenticationResult"].keys())
|
|
343
|
+
_LOGGER.debug(
|
|
344
|
+
"Device login successful — AuthenticationResult keys: %s", auth_keys
|
|
345
|
+
)
|
|
315
346
|
await self.updateTokens(result)
|
|
316
|
-
self.tokens.tokenExpiry = timedelta(seconds=0)
|
|
317
347
|
return result
|
|
318
348
|
|
|
319
349
|
async def _retryDeviceLogin(self):
|
|
@@ -386,6 +416,11 @@ class HiveSession:
|
|
|
386
416
|
)
|
|
387
417
|
|
|
388
418
|
if result and "AuthenticationResult" in result:
|
|
419
|
+
auth_keys = list(result["AuthenticationResult"].keys())
|
|
420
|
+
_LOGGER.debug(
|
|
421
|
+
"Token refresh — AuthenticationResult keys: %s",
|
|
422
|
+
auth_keys,
|
|
423
|
+
)
|
|
389
424
|
await self.updateTokens(result)
|
|
390
425
|
new_expiry = (
|
|
391
426
|
self.tokens.tokenCreated + self.tokens.tokenExpiry
|
|
@@ -535,12 +570,28 @@ class HiveSession:
|
|
|
535
570
|
"falling back to full device re-login."
|
|
536
571
|
)
|
|
537
572
|
await self._retryDeviceLogin()
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
573
|
+
last_auth_err = None
|
|
574
|
+
for api_retry_delay in (0, 2, 5):
|
|
575
|
+
try:
|
|
576
|
+
if api_retry_delay:
|
|
577
|
+
_LOGGER.debug(
|
|
578
|
+
"Retrying API call in %ss after device re-login.",
|
|
579
|
+
api_retry_delay,
|
|
580
|
+
)
|
|
581
|
+
await asyncio.sleep(api_retry_delay)
|
|
582
|
+
api_resp_d = await self.api.getAll()
|
|
583
|
+
last_auth_err = None
|
|
584
|
+
break
|
|
585
|
+
except HiveAuthError as retry_err:
|
|
586
|
+
_LOGGER.warning(
|
|
587
|
+
"API call still rejected after device re-login (attempt delay=%ss).",
|
|
588
|
+
api_retry_delay,
|
|
589
|
+
)
|
|
590
|
+
last_auth_err = retry_err
|
|
591
|
+
if last_auth_err is not None:
|
|
592
|
+
raise HiveReauthRequired from last_auth_err
|
|
542
593
|
api_call_duration = time.monotonic() - api_call_start
|
|
543
|
-
if api_call_duration >
|
|
594
|
+
if api_call_duration > self._slowPollThreshold:
|
|
544
595
|
_LOGGER.warning(
|
|
545
596
|
"Hive API response took %.1fs — marking poll as slow.",
|
|
546
597
|
api_call_duration,
|
|
@@ -595,7 +646,9 @@ class HiveSession:
|
|
|
595
646
|
get_nodes_successful = True
|
|
596
647
|
except HiveReauthRequired:
|
|
597
648
|
_LOGGER.error("Reauthentication required, propagating to caller.")
|
|
598
|
-
self.config.lastUpdate =
|
|
649
|
+
self.config.lastUpdate = (
|
|
650
|
+
datetime.now() - self.config.scanInterval + timedelta(seconds=30)
|
|
651
|
+
)
|
|
599
652
|
raise
|
|
600
653
|
except asyncio.TimeoutError:
|
|
601
654
|
_LOGGER.warning("Hive API request timed out — keeping cached device data.")
|
|
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
|
{pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/hive_exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
{pyhive_integration-1.0.8.dev7 → pyhive_integration-1.0.8.dev8}/src/helper/hivedataclasses.py
RENAMED
|
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
|