pysmarlaapi 0.2.0__tar.gz → 0.2.1__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.2.0 → pysmarlaapi-0.2.1}/PKG-INFO +1 -1
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/__init__.py +1 -1
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/classes/connection.py +1 -6
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/connection_hub/__init__.py +2 -1
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/__init__.py +3 -2
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/tests/test.py +4 -2
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/.gitignore +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/.pre-commit-config.yaml +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/.pypirc +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/.vscode/launch.json +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/.vscode/settings.json +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/README.md +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pyproject.toml +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/classes/__init__.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/classes/auth_token.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/classes/__init__.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/classes/property.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/classes/service.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/services/__init__.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/services/analyser_service.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/services/babywiege_service.py +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/requirements.txt +0 -0
- {pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/requirements_dev.txt +0 -0
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
|
|
3
1
|
import aiohttp
|
|
4
2
|
import jsonpickle
|
|
5
3
|
|
|
@@ -8,10 +6,7 @@ from . import AuthToken
|
|
|
8
6
|
|
|
9
7
|
class Connection:
|
|
10
8
|
|
|
11
|
-
def __init__(
|
|
12
|
-
self, event_loop: asyncio.AbstractEventLoop, url: str, token: AuthToken = None, token_str=None, token_json=None
|
|
13
|
-
):
|
|
14
|
-
self.event_loop = event_loop
|
|
9
|
+
def __init__(self, url: str, token: AuthToken = None, token_str=None, token_json=None):
|
|
15
10
|
self.url = url
|
|
16
11
|
if token is not None:
|
|
17
12
|
self.token = token
|
|
@@ -31,12 +31,13 @@ class ConnectionHub:
|
|
|
31
31
|
|
|
32
32
|
def __init__(
|
|
33
33
|
self,
|
|
34
|
+
event_loop: asyncio.AbstractEventLoop,
|
|
34
35
|
connection: Connection,
|
|
35
36
|
interval: int = 60,
|
|
36
37
|
backoff: int = 300,
|
|
37
38
|
):
|
|
38
39
|
self.connection: Connection = connection
|
|
39
|
-
self._loop
|
|
40
|
+
self._loop = event_loop
|
|
40
41
|
self._interval = interval
|
|
41
42
|
self._backoff = backoff
|
|
42
43
|
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import asyncio
|
|
1
2
|
import threading
|
|
2
3
|
|
|
3
4
|
from ..classes import Connection
|
|
@@ -21,9 +22,9 @@ class Federwiege:
|
|
|
21
22
|
if value:
|
|
22
23
|
self.sync()
|
|
23
24
|
|
|
24
|
-
def __init__(self, connection: Connection):
|
|
25
|
+
def __init__(self, event_loop: asyncio.AbstractEventLoop, connection: Connection):
|
|
25
26
|
self.serial_number = connection.token.serialNumber
|
|
26
|
-
self.hub = ConnectionHub(connection)
|
|
27
|
+
self.hub = ConnectionHub(event_loop, connection)
|
|
27
28
|
self.services: dict[str, Service] = {
|
|
28
29
|
"babywiege": BabywiegeService(self.hub),
|
|
29
30
|
"analyser": AnalyserService(self.hub),
|
|
@@ -18,9 +18,9 @@ except ImportError:
|
|
|
18
18
|
loop = asyncio.get_event_loop()
|
|
19
19
|
async_thread = threading.Thread(target=loop.run_forever)
|
|
20
20
|
|
|
21
|
-
connection = Connection(
|
|
21
|
+
connection = Connection(url=HOST, token_json=AUTH_TOKEN_PERSONAL)
|
|
22
22
|
|
|
23
|
-
federwiege = Federwiege(connection)
|
|
23
|
+
federwiege = Federwiege(loop, connection)
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
def main():
|
|
@@ -74,4 +74,6 @@ if __name__ == "__main__":
|
|
|
74
74
|
except BaseException:
|
|
75
75
|
pass
|
|
76
76
|
federwiege.disconnect()
|
|
77
|
+
while federwiege.connected:
|
|
78
|
+
time.sleep(1)
|
|
77
79
|
loop.call_soon_threadsafe(loop.stop)
|
|
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
|
{pysmarlaapi-0.2.0 → pysmarlaapi-0.2.1}/pysmarlaapi/federwiege/services/babywiege_service.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|