pytouchlinesl 0.1.2__tar.gz → 0.1.4__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.
- {pytouchlinesl-0.1.2/pytouchlinesl.egg-info → pytouchlinesl-0.1.4}/PKG-INFO +2 -2
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pyproject.toml +2 -2
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/client/base.py +5 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/client/client.py +26 -6
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/client/models/models.py +5 -2
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/touchlinesl.py +4 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/zone.py +5 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4/pytouchlinesl.egg-info}/PKG-INFO +2 -2
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl.egg-info/requires.txt +1 -1
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/LICENSE +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/README.md +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/__init__.py +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/client/__init__.py +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/client/models/__init__.py +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl/module.py +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl.egg-info/SOURCES.txt +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl.egg-info/dependency_links.txt +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/pytouchlinesl.egg-info/top_level.txt +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/setup.cfg +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/tests/test_module.py +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/tests/test_touchlinesl.py +0 -0
- {pytouchlinesl-0.1.2 → pytouchlinesl-0.1.4}/tests/test_zone.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytouchlinesl
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: An API client for Roth's TouchlineSL control system.
|
|
5
5
|
Author-email: Jon Seager <jon@sgrs.uk>
|
|
6
6
|
Project-URL: Homepage, https://github.com/jnsgruk/pytouchlinesl
|
|
@@ -12,7 +12,7 @@ Requires-Python: >=3.10
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: aiohttp
|
|
15
|
-
Requires-Dist: pydantic
|
|
15
|
+
Requires-Dist: pydantic
|
|
16
16
|
Provides-Extra: dev
|
|
17
17
|
Requires-Dist: pytest; extra == "dev"
|
|
18
18
|
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "pytouchlinesl"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.4"
|
|
4
4
|
authors = [{ name = "Jon Seager", email = "jon@sgrs.uk" }]
|
|
5
5
|
description = "An API client for Roth's TouchlineSL control system."
|
|
6
6
|
readme = "README.md"
|
|
@@ -10,7 +10,7 @@ classifiers = [
|
|
|
10
10
|
"License :: OSI Approved :: Apache Software License",
|
|
11
11
|
"Operating System :: OS Independent",
|
|
12
12
|
]
|
|
13
|
-
dependencies = ["aiohttp", "pydantic
|
|
13
|
+
dependencies = ["aiohttp", "pydantic"]
|
|
14
14
|
|
|
15
15
|
[project.optional-dependencies]
|
|
16
16
|
dev = ["pytest", "pytest-asyncio", "ruff"]
|
|
@@ -10,6 +10,11 @@ from .models import ModuleModel
|
|
|
10
10
|
class BaseClient(ABC):
|
|
11
11
|
"""Base API client implementation for Roth API clients."""
|
|
12
12
|
|
|
13
|
+
@abstractmethod
|
|
14
|
+
async def user_id(self) -> str:
|
|
15
|
+
"""Return the unique user id for the authenticated account."""
|
|
16
|
+
pass
|
|
17
|
+
|
|
13
18
|
@abstractmethod
|
|
14
19
|
async def authenticated(self) -> bool:
|
|
15
20
|
"""Report whether or not the client is authenticated with the API."""
|
|
@@ -73,6 +73,14 @@ class RothAPI(BaseClient):
|
|
|
73
73
|
self._user_id = resp.get("user_id")
|
|
74
74
|
self._token = resp.get("token")
|
|
75
75
|
|
|
76
|
+
async def user_id(self) -> str:
|
|
77
|
+
"""Return the unique user id for the authenticated account."""
|
|
78
|
+
if self._token is None:
|
|
79
|
+
await self._login()
|
|
80
|
+
|
|
81
|
+
assert isinstance(self._user_id, str)
|
|
82
|
+
return self._user_id
|
|
83
|
+
|
|
76
84
|
async def authenticated(self) -> bool:
|
|
77
85
|
"""Report whether or not the client is authenticated with the API."""
|
|
78
86
|
if self._token is None:
|
|
@@ -131,6 +139,22 @@ class RothAPI(BaseClient):
|
|
|
131
139
|
or z.zone.id == zone_id
|
|
132
140
|
]
|
|
133
141
|
|
|
142
|
+
# pydantic v1 compatibility
|
|
143
|
+
try:
|
|
144
|
+
p0_intervals = [
|
|
145
|
+
i.dict(by_alias=True) for i in schedule.p0_intervals if i.start != 6100
|
|
146
|
+
]
|
|
147
|
+
p1_intervals = [
|
|
148
|
+
i.dict(by_alias=True) for i in schedule.p1_intervals if i.start != 6100
|
|
149
|
+
]
|
|
150
|
+
except AttributeError:
|
|
151
|
+
p0_intervals = [
|
|
152
|
+
i.model_dump(by_alias=True) for i in schedule.p0_intervals if i.start != 6100
|
|
153
|
+
]
|
|
154
|
+
p1_intervals = [
|
|
155
|
+
i.model_dump(by_alias=True) for i in schedule.p1_intervals if i.start != 6100
|
|
156
|
+
]
|
|
157
|
+
|
|
134
158
|
# TODO: This be simplified with Pydantic models
|
|
135
159
|
data = {
|
|
136
160
|
"scheduleName": schedule.name,
|
|
@@ -142,14 +166,10 @@ class RothAPI(BaseClient):
|
|
|
142
166
|
"p0SetbackTemp": schedule.p0_setback_temp,
|
|
143
167
|
# Empty intervals start/end with a value of 6100, which is invalid
|
|
144
168
|
# if sent in this request.
|
|
145
|
-
"p0Intervals":
|
|
146
|
-
i.dict(by_alias=True) for i in schedule.p0_intervals if i.start != 6100
|
|
147
|
-
],
|
|
169
|
+
"p0Intervals": p0_intervals,
|
|
148
170
|
"p1Days": schedule.p1_days,
|
|
149
171
|
"p1SetbackTemp": schedule.p1_setback_temp,
|
|
150
|
-
"p1Intervals":
|
|
151
|
-
i.dict(by_alias=True) for i in schedule.p1_intervals if i.start != 6100
|
|
152
|
-
],
|
|
172
|
+
"p1Intervals": p1_intervals,
|
|
153
173
|
},
|
|
154
174
|
}
|
|
155
175
|
|
|
@@ -6,7 +6,10 @@ tweaks to types and names.
|
|
|
6
6
|
|
|
7
7
|
from typing import Any, Dict, List, Literal, Optional
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
try:
|
|
10
|
+
from pydantic.v1 import BaseModel, Field
|
|
11
|
+
except ImportError:
|
|
12
|
+
from pydantic import BaseModel, Field
|
|
10
13
|
|
|
11
14
|
|
|
12
15
|
class ZoneFlagsModel(BaseModel):
|
|
@@ -27,7 +30,7 @@ class ZoneAttributesModel(BaseModel):
|
|
|
27
30
|
current_temperature: Optional[int] = Field(..., alias="currentTemperature")
|
|
28
31
|
set_temperature: int = Field(..., alias="setTemperature")
|
|
29
32
|
flags: ZoneFlagsModel
|
|
30
|
-
zone_state: Literal["zoneOff", "noAlarm"] = Field(..., alias="zoneState")
|
|
33
|
+
zone_state: Literal["zoneOff", "noAlarm", "zoneUnregistered"] = Field(..., alias="zoneState")
|
|
31
34
|
signal_strength: Optional[int] = Field(..., alias="signalStrength")
|
|
32
35
|
battery_level: Optional[int] = Field(..., alias="batteryLevel")
|
|
33
36
|
actuators_open: int = Field(..., alias="actuatorsOpen")
|
|
@@ -52,6 +52,10 @@ class TouchlineSL:
|
|
|
52
52
|
raise TypeError("username and password must be strings if no client is provided")
|
|
53
53
|
self._client = RothAPI(username=username, password=password)
|
|
54
54
|
|
|
55
|
+
async def user_id(self) -> str:
|
|
56
|
+
"""Return the unique user ID of the authenticated account."""
|
|
57
|
+
return await self._client.user_id()
|
|
58
|
+
|
|
55
59
|
async def modules(self, *, refresh: bool = False) -> list[Module]:
|
|
56
60
|
"""Report a list of Roth TouchlineSL modules associated with the account.
|
|
57
61
|
|
|
@@ -72,6 +72,11 @@ class Zone:
|
|
|
72
72
|
"""Return the ID of the zone."""
|
|
73
73
|
return self._raw_data.zone.id
|
|
74
74
|
|
|
75
|
+
@property
|
|
76
|
+
def battery_level(self) -> int | None:
|
|
77
|
+
"""Return the battery level of the zone."""
|
|
78
|
+
return self._raw_data.zone.battery_level
|
|
79
|
+
|
|
75
80
|
@property
|
|
76
81
|
def temperature(self) -> float | None:
|
|
77
82
|
"""Return the current temperature of the zone, if it's enabled, otherwise None."""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pytouchlinesl
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: An API client for Roth's TouchlineSL control system.
|
|
5
5
|
Author-email: Jon Seager <jon@sgrs.uk>
|
|
6
6
|
Project-URL: Homepage, https://github.com/jnsgruk/pytouchlinesl
|
|
@@ -12,7 +12,7 @@ Requires-Python: >=3.10
|
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
14
|
Requires-Dist: aiohttp
|
|
15
|
-
Requires-Dist: pydantic
|
|
15
|
+
Requires-Dist: pydantic
|
|
16
16
|
Provides-Extra: dev
|
|
17
17
|
Requires-Dist: pytest; extra == "dev"
|
|
18
18
|
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
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
|