pysmarlaapi 0.10.3__py3-none-any.whl → 0.11.0__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/federwiege/__init__.py +20 -0
- {pysmarlaapi-0.10.3.dist-info → pysmarlaapi-0.11.0.dist-info}/METADATA +1 -1
- {pysmarlaapi-0.10.3.dist-info → pysmarlaapi-0.11.0.dist-info}/RECORD +6 -6
- {pysmarlaapi-0.10.3.dist-info → pysmarlaapi-0.11.0.dist-info}/WHEEL +0 -0
- {pysmarlaapi-0.10.3.dist-info → pysmarlaapi-0.11.0.dist-info}/licenses/LICENSE +0 -0
pysmarlaapi/__init__.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
import threading
|
|
3
3
|
|
|
4
|
+
import aiohttp
|
|
5
|
+
|
|
4
6
|
from ..classes import Connection
|
|
5
7
|
from ..connection_hub import ConnectionHub
|
|
6
8
|
from .classes import Service
|
|
@@ -25,6 +27,7 @@ class Federwiege:
|
|
|
25
27
|
|
|
26
28
|
def __init__(self, event_loop: asyncio.AbstractEventLoop, connection: Connection):
|
|
27
29
|
self.serial_number = connection.token.serialNumber
|
|
30
|
+
self.connection = connection
|
|
28
31
|
self.hub = ConnectionHub(event_loop, connection, self.on_connection_change)
|
|
29
32
|
self.services: dict[str, Service] = {
|
|
30
33
|
"babywiege": BabywiegeService(self.hub),
|
|
@@ -38,6 +41,23 @@ class Federwiege:
|
|
|
38
41
|
|
|
39
42
|
self.available = False
|
|
40
43
|
|
|
44
|
+
async def check_firmware_update(self) -> tuple[str, str] | None:
|
|
45
|
+
await self.connection.refresh_token()
|
|
46
|
+
|
|
47
|
+
try:
|
|
48
|
+
async with aiohttp.ClientSession(self.connection.url) as session:
|
|
49
|
+
response = await session.get(
|
|
50
|
+
"/api/Firmware/CheckFirmwareUpdate",
|
|
51
|
+
headers={"accept": "*/*", "Content-Type": "application/json", "Authorization": f"Bearer {self.connection.get_token()}"},
|
|
52
|
+
)
|
|
53
|
+
if response.status != 200:
|
|
54
|
+
return None
|
|
55
|
+
content = await response.json()
|
|
56
|
+
except (aiohttp.ClientError, asyncio.TimeoutError):
|
|
57
|
+
return None
|
|
58
|
+
|
|
59
|
+
return (content["targetFirmware"], content["releaseNotes"])
|
|
60
|
+
|
|
41
61
|
def get_service(self, key: str):
|
|
42
62
|
if key not in self.services:
|
|
43
63
|
return None
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
pysmarlaapi/__init__.py,sha256=
|
|
1
|
+
pysmarlaapi/__init__.py,sha256=lPK0ph5QVp49f0r6LHfWaHxR1UZoQbROA3xR2fc_PuE,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
5
|
pysmarlaapi/connection_hub/__init__.py,sha256=QUwB7j5BdF5dwal1_uFPUC7hqOMojLUeGlKHcd_32HQ,4624
|
|
6
|
-
pysmarlaapi/federwiege/__init__.py,sha256=
|
|
6
|
+
pysmarlaapi/federwiege/__init__.py,sha256=hQQ2UzctwUlQKIb2NzQhwuK9zsm-luCxmlzH33XmGZU,2772
|
|
7
7
|
pysmarlaapi/federwiege/classes/__init__.py,sha256=DFJJVOKpra40S4ZX_oq2RyMazg6Nx0c8hoPggmj1bXA,60
|
|
8
8
|
pysmarlaapi/federwiege/classes/property.py,sha256=S5Zzo9cXDJMFcQG1vCw1eO-oqeSpQs2YjxWouN_KRkU,1032
|
|
9
9
|
pysmarlaapi/federwiege/classes/service.py,sha256=Y0OQxtQLaHp4qY8Vthj0zRroPoYTiD2WA9ZR96teZTo,632
|
|
@@ -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.
|
|
20
|
-
pysmarlaapi-0.
|
|
21
|
-
pysmarlaapi-0.
|
|
22
|
-
pysmarlaapi-0.
|
|
19
|
+
pysmarlaapi-0.11.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
20
|
+
pysmarlaapi-0.11.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
|
|
21
|
+
pysmarlaapi-0.11.0.dist-info/METADATA,sha256=TDbU8RrOERkgOjCtM51R2y7ZQtWk6rxl0_m1gzoH6PI,1104
|
|
22
|
+
pysmarlaapi-0.11.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|