plugwise 0.38.0__py3-none-any.whl → 0.38.2__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.
- plugwise/__init__.py +50 -15
- plugwise/constants.py +2 -1
- plugwise/helper.py +41 -41
- plugwise/legacy/smile.py +18 -8
- plugwise/smile.py +21 -21
- {plugwise-0.38.0.dist-info → plugwise-0.38.2.dist-info}/METADATA +1 -1
- plugwise-0.38.2.dist-info/RECORD +17 -0
- plugwise-0.38.0.dist-info/RECORD +0 -17
- {plugwise-0.38.0.dist-info → plugwise-0.38.2.dist-info}/LICENSE +0 -0
- {plugwise-0.38.0.dist-info → plugwise-0.38.2.dist-info}/WHEEL +0 -0
- {plugwise-0.38.0.dist-info → plugwise-0.38.2.dist-info}/top_level.txt +0 -0
plugwise/__init__.py
CHANGED
@@ -5,6 +5,7 @@ Plugwise backend module for Home Assistant Core.
|
|
5
5
|
from __future__ import annotations
|
6
6
|
|
7
7
|
from plugwise.constants import (
|
8
|
+
DEFAULT_LEGACY_TIMEOUT,
|
8
9
|
DEFAULT_PORT,
|
9
10
|
DEFAULT_TIMEOUT,
|
10
11
|
DEFAULT_USERNAME,
|
@@ -46,7 +47,7 @@ class Smile(SmileComm):
|
|
46
47
|
websession: aiohttp.ClientSession,
|
47
48
|
username: str = DEFAULT_USERNAME,
|
48
49
|
port: int = DEFAULT_PORT,
|
49
|
-
timeout: float =
|
50
|
+
timeout: float = DEFAULT_LEGACY_TIMEOUT,
|
50
51
|
|
51
52
|
) -> None:
|
52
53
|
"""Set the constructor for this class."""
|
@@ -128,6 +129,7 @@ class Smile(SmileComm):
|
|
128
129
|
self._smile_api = SmileAPI(
|
129
130
|
self._host,
|
130
131
|
self._passwd,
|
132
|
+
self._timeout,
|
131
133
|
self._websession,
|
132
134
|
self._cooling_present,
|
133
135
|
self._elga,
|
@@ -147,10 +149,10 @@ class Smile(SmileComm):
|
|
147
149
|
self.smile_type,
|
148
150
|
self._user,
|
149
151
|
self._port,
|
150
|
-
self._timeout,
|
151
152
|
) if not self.smile_legacy else SmileLegacyAPI(
|
152
153
|
self._host,
|
153
154
|
self._passwd,
|
155
|
+
self._timeout,
|
154
156
|
self._websession,
|
155
157
|
self._is_thermostat,
|
156
158
|
self._on_off_device,
|
@@ -168,7 +170,6 @@ class Smile(SmileComm):
|
|
168
170
|
self.smile_zigbee_mac_address,
|
169
171
|
self._user,
|
170
172
|
self._port,
|
171
|
-
self._timeout,
|
172
173
|
)
|
173
174
|
|
174
175
|
# Update all endpoints on first connect
|
@@ -192,6 +193,9 @@ class Smile(SmileComm):
|
|
192
193
|
else:
|
193
194
|
model = await self._smile_detect_legacy(result, dsmrmain, model)
|
194
195
|
|
196
|
+
if not self.smile_legacy:
|
197
|
+
self._timeout = DEFAULT_TIMEOUT
|
198
|
+
|
195
199
|
if model == "Unknown" or self.smile_fw_version is None: # pragma: no cover
|
196
200
|
# Corner case check
|
197
201
|
LOGGER.error(
|
@@ -324,7 +328,10 @@ class Smile(SmileComm):
|
|
324
328
|
state: str | None = None,
|
325
329
|
) -> None:
|
326
330
|
"""Set the selected option for the applicable Select."""
|
327
|
-
|
331
|
+
try:
|
332
|
+
await self._smile_api.set_select(key, loc_id, option, state)
|
333
|
+
except ConnectionFailedError as exc:
|
334
|
+
raise ConnectionFailedError(f"Failed to set select option '{option}': {str(exc)}") from exc
|
328
335
|
|
329
336
|
async def set_schedule_state(
|
330
337
|
self,
|
@@ -333,15 +340,25 @@ class Smile(SmileComm):
|
|
333
340
|
name: str | None = None,
|
334
341
|
) -> None:
|
335
342
|
"""Activate/deactivate the Schedule, with the given name, on the relevant Thermostat."""
|
336
|
-
|
343
|
+
try:
|
344
|
+
await self._smile_api.set_schedule_state(loc_id, state, name)
|
345
|
+
except ConnectionFailedError as exc: # pragma no cover
|
346
|
+
raise ConnectionFailedError(f"Failed to set schedule state: {str(exc)}") from exc # pragma no cover
|
347
|
+
|
337
348
|
|
338
349
|
async def set_preset(self, loc_id: str, preset: str) -> None:
|
339
350
|
"""Set the given Preset on the relevant Thermostat."""
|
340
|
-
|
351
|
+
try:
|
352
|
+
await self._smile_api.set_preset(loc_id, preset)
|
353
|
+
except ConnectionFailedError as exc:
|
354
|
+
raise ConnectionFailedError(f"Failed to set preset: {str(exc)}") from exc
|
341
355
|
|
342
356
|
async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
|
343
357
|
"""Set the given Temperature on the relevant Thermostat."""
|
344
|
-
|
358
|
+
try:
|
359
|
+
await self._smile_api.set_temperature(loc_id, items)
|
360
|
+
except ConnectionFailedError as exc:
|
361
|
+
raise ConnectionFailedError(f"Failed to set temperature: {str(exc)}") from exc
|
345
362
|
|
346
363
|
async def set_number(
|
347
364
|
self,
|
@@ -350,40 +367,58 @@ class Smile(SmileComm):
|
|
350
367
|
temperature: float,
|
351
368
|
) -> None:
|
352
369
|
"""Set the maximum boiler- or DHW-setpoint on the Central Heating boiler or the temperature-offset on a Thermostat."""
|
353
|
-
|
370
|
+
try:
|
371
|
+
await self._smile_api.set_number(dev_id, key, temperature)
|
372
|
+
except ConnectionFailedError as exc:
|
373
|
+
raise ConnectionFailedError(f"Failed to set number '{key}': {str(exc)}") from exc
|
354
374
|
|
355
375
|
async def set_temperature_offset(self, dev_id: str, offset: float) -> None:
|
356
376
|
"""Set the Temperature offset for thermostats that support this feature."""
|
357
|
-
|
377
|
+
try: # pragma no cover
|
378
|
+
await self._smile_api.set_offset(dev_id, offset) # pragma: no cover
|
379
|
+
except ConnectionFailedError as exc: # pragma no cover
|
380
|
+
raise ConnectionFailedError(f"Failed to set temperature offset: {str(exc)}") from exc # pragma no cover
|
358
381
|
|
359
382
|
async def set_switch_state(
|
360
383
|
self, appl_id: str, members: list[str] | None, model: str, state: str
|
361
384
|
) -> None:
|
362
385
|
"""Set the given State of the relevant Switch."""
|
363
|
-
|
386
|
+
try:
|
387
|
+
await self._smile_api.set_switch_state(appl_id, members, model, state)
|
388
|
+
except ConnectionFailedError as exc:
|
389
|
+
raise ConnectionFailedError(f"Failed to set switch state: {str(exc)}") from exc
|
364
390
|
|
365
391
|
async def set_gateway_mode(self, mode: str) -> None:
|
366
392
|
"""Set the gateway mode."""
|
367
|
-
|
393
|
+
try: # pragma no cover
|
394
|
+
await self._smile_api.set_gateway_mode(mode) # pragma: no cover
|
395
|
+
except ConnectionFailedError as exc: # pragma no cover
|
396
|
+
raise ConnectionFailedError(f"Failed to set gateway mode: {str(exc)}") from exc # pragma no cover
|
368
397
|
|
369
398
|
async def set_regulation_mode(self, mode: str) -> None:
|
370
399
|
"""Set the heating regulation mode."""
|
371
|
-
|
400
|
+
try: # pragma no cover
|
401
|
+
await self._smile_api.set_regulation_mode(mode) # pragma: no cover
|
402
|
+
except ConnectionFailedError as exc: # pragma no cover
|
403
|
+
raise ConnectionFailedError(f"Failed to set regulation mode: {str(exc)}") from exc # pragma no cover
|
372
404
|
|
373
405
|
async def set_dhw_mode(self, mode: str) -> None:
|
374
406
|
"""Set the domestic hot water heating regulation mode."""
|
375
|
-
|
407
|
+
try: # pragma no cover
|
408
|
+
await self._smile_api.set_dhw_mode(mode) # pragma: no cover
|
409
|
+
except ConnectionFailedError as exc: # pragma no cover
|
410
|
+
raise ConnectionFailedError(f"Failed to set dhw mode: {str(exc)}") from exc # pragma no cover
|
376
411
|
|
377
412
|
async def delete_notification(self) -> None:
|
378
413
|
"""Delete the active Plugwise Notification."""
|
379
414
|
try:
|
380
415
|
await self._smile_api.delete_notification()
|
381
416
|
except ConnectionFailedError as exc:
|
382
|
-
raise
|
417
|
+
raise ConnectionFailedError(f"Failed to delete notification: {str(exc)}") from exc
|
383
418
|
|
384
419
|
async def reboot_gateway(self) -> None:
|
385
420
|
"""Reboot the Plugwise Gateway."""
|
386
421
|
try:
|
387
422
|
await self._smile_api.reboot_gateway()
|
388
423
|
except ConnectionFailedError as exc:
|
389
|
-
raise
|
424
|
+
raise ConnectionFailedError(f"Failed to reboot gateway: {str(exc)}") from exc
|
plugwise/constants.py
CHANGED
@@ -32,7 +32,8 @@ VOLUME_CUBIC_METERS_PER_HOUR: Final = "m³/h"
|
|
32
32
|
|
33
33
|
ADAM: Final = "Adam"
|
34
34
|
ANNA: Final = "Smile Anna"
|
35
|
-
DEFAULT_TIMEOUT: Final =
|
35
|
+
DEFAULT_TIMEOUT: Final = 10
|
36
|
+
DEFAULT_LEGACY_TIMEOUT: Final = 30
|
36
37
|
DEFAULT_USERNAME: Final = "smile"
|
37
38
|
DEFAULT_PORT: Final = 80
|
38
39
|
DEFAULT_PW_MAX: Final = 30.0
|
plugwise/helper.py
CHANGED
@@ -115,30 +115,31 @@ class SmileComm:
|
|
115
115
|
use_headers = headers
|
116
116
|
|
117
117
|
try:
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
118
|
+
match method:
|
119
|
+
case "delete":
|
120
|
+
resp = await self._websession.delete(url, auth=self._auth)
|
121
|
+
case "get":
|
122
|
+
# Work-around for Stretchv2, should not hurt the other smiles
|
123
|
+
use_headers = {"Accept-Encoding": "gzip"}
|
124
|
+
resp = await self._websession.get(
|
125
|
+
url, headers=use_headers, auth=self._auth
|
126
|
+
)
|
127
|
+
case "post":
|
128
|
+
use_headers = {"Content-type": "text/xml"}
|
129
|
+
resp = await self._websession.post(
|
130
|
+
url,
|
131
|
+
headers=use_headers,
|
132
|
+
data=data,
|
133
|
+
auth=self._auth,
|
134
|
+
)
|
135
|
+
case "put":
|
136
|
+
use_headers = {"Content-type": "text/xml"}
|
137
|
+
resp = await self._websession.put(
|
138
|
+
url,
|
139
|
+
headers=use_headers,
|
140
|
+
data=data,
|
141
|
+
auth=self._auth,
|
142
|
+
)
|
142
143
|
except (
|
143
144
|
ClientError
|
144
145
|
) as exc: # ClientError is an ancestor class of ServerTimeoutError
|
@@ -167,23 +168,22 @@ class SmileComm:
|
|
167
168
|
|
168
169
|
async def _request_validate(self, resp: ClientResponse, method: str) -> etree:
|
169
170
|
"""Helper-function for _request(): validate the returned data."""
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
raise ConnectionFailedError
|
171
|
+
match resp.status:
|
172
|
+
case 200:
|
173
|
+
# Cornercases for server not responding with 202
|
174
|
+
if method in ("post", "put"):
|
175
|
+
return
|
176
|
+
case 202:
|
177
|
+
# Command accepted gives empty body with status 202
|
178
|
+
return
|
179
|
+
case 401:
|
180
|
+
msg = "Invalid Plugwise login, please retry with the correct credentials."
|
181
|
+
LOGGER.error("%s", msg)
|
182
|
+
raise InvalidAuthentication
|
183
|
+
case 405:
|
184
|
+
msg = "405 Method not allowed."
|
185
|
+
LOGGER.error("%s", msg)
|
186
|
+
raise ConnectionFailedError
|
187
187
|
|
188
188
|
if not (result := await resp.text()) or (
|
189
189
|
"<error>" in result and "Not started" not in result
|
plugwise/legacy/smile.py
CHANGED
@@ -5,11 +5,11 @@ Plugwise backend module for Home Assistant Core - covering the legacy P1, Anna,
|
|
5
5
|
from __future__ import annotations
|
6
6
|
|
7
7
|
import datetime as dt
|
8
|
+
from typing import Any
|
8
9
|
|
9
10
|
from plugwise.constants import (
|
10
11
|
APPLIANCES,
|
11
12
|
DEFAULT_PORT,
|
12
|
-
DEFAULT_TIMEOUT,
|
13
13
|
DEFAULT_USERNAME,
|
14
14
|
DOMAIN_OBJECTS,
|
15
15
|
LOCATIONS,
|
@@ -23,7 +23,7 @@ from plugwise.constants import (
|
|
23
23
|
PlugwiseData,
|
24
24
|
ThermoLoc,
|
25
25
|
)
|
26
|
-
from plugwise.exceptions import PlugwiseError
|
26
|
+
from plugwise.exceptions import ConnectionFailedError, PlugwiseError
|
27
27
|
from plugwise.helper import SmileComm
|
28
28
|
from plugwise.legacy.data import SmileLegacyData
|
29
29
|
|
@@ -40,6 +40,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
40
40
|
self,
|
41
41
|
host: str,
|
42
42
|
password: str,
|
43
|
+
timeout: float,
|
43
44
|
websession: aiohttp.ClientSession,
|
44
45
|
_is_thermostat: bool,
|
45
46
|
_on_off_device: bool,
|
@@ -57,7 +58,6 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
57
58
|
smile_zigbee_mac_address: str | None,
|
58
59
|
username: str = DEFAULT_USERNAME,
|
59
60
|
port: int = DEFAULT_PORT,
|
60
|
-
timeout: float = DEFAULT_TIMEOUT,
|
61
61
|
) -> None:
|
62
62
|
"""Set the constructor for this class."""
|
63
63
|
super().__init__(
|
@@ -76,6 +76,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
76
76
|
self._opentherm_device = _opentherm_device
|
77
77
|
self._stretch_v2 = _stretch_v2
|
78
78
|
self._target_smile = _target_smile
|
79
|
+
self._timeout = timeout
|
79
80
|
self.loc_data = loc_data
|
80
81
|
self.smile_fw_version = smile_fw_version
|
81
82
|
self.smile_hostname = smile_hostname
|
@@ -180,7 +181,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
180
181
|
rule = self._domain_objects.find(locator)
|
181
182
|
data = f'<rules><rule id="{rule.attrib["id"]}"><active>true</active></rule></rules>'
|
182
183
|
|
183
|
-
await self.
|
184
|
+
await self.call_request(RULES, method="put", data=data)
|
184
185
|
|
185
186
|
async def set_regulation_mode(self, mode: str) -> None:
|
186
187
|
"""Set-function placeholder for legacy devices."""
|
@@ -226,7 +227,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
226
227
|
f' id="{template_id}" /><active>{new_state}</active></rule></rules>'
|
227
228
|
)
|
228
229
|
|
229
|
-
await self.
|
230
|
+
await self.call_request(uri, method="put", data=data)
|
230
231
|
|
231
232
|
async def set_switch_state(
|
232
233
|
self, appl_id: str, members: list[str] | None, model: str, state: str
|
@@ -254,7 +255,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
254
255
|
if self._appliances.find(locator).text == "true":
|
255
256
|
raise PlugwiseError("Plugwise: the locked Relay was not switched.")
|
256
257
|
|
257
|
-
await self.
|
258
|
+
await self.call_request(uri, method="put", data=data)
|
258
259
|
|
259
260
|
async def _set_groupswitch_member_state(
|
260
261
|
self, members: list[str], state: str, switch: Munch
|
@@ -267,7 +268,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
267
268
|
uri = f"{APPLIANCES};id={member}/{switch.func_type}"
|
268
269
|
data = f"<{switch.func_type}><{switch.func}>{state}</{switch.func}></{switch.func_type}>"
|
269
270
|
|
270
|
-
await self.
|
271
|
+
await self.call_request(uri, method="put", data=data)
|
271
272
|
|
272
273
|
async def set_temperature(self, _: str, items: dict[str, float]) -> None:
|
273
274
|
"""Set the given Temperature on the relevant Thermostat."""
|
@@ -287,4 +288,13 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
287
288
|
f"{temperature}</setpoint></thermostat_functionality>"
|
288
289
|
)
|
289
290
|
|
290
|
-
await self.
|
291
|
+
await self.call_request(uri, method="put", data=data)
|
292
|
+
|
293
|
+
async def call_request(self, uri: str, **kwargs: Any) -> None:
|
294
|
+
"""ConnectionFailedError wrapper for calling _request()."""
|
295
|
+
method: str = kwargs["method"]
|
296
|
+
data: str | None = kwargs.get("data")
|
297
|
+
try:
|
298
|
+
await self._request(uri, method=method, data=data)
|
299
|
+
except ConnectionFailedError as exc:
|
300
|
+
raise ConnectionFailedError from exc
|
plugwise/smile.py
CHANGED
@@ -12,7 +12,6 @@ from plugwise.constants import (
|
|
12
12
|
ANNA,
|
13
13
|
APPLIANCES,
|
14
14
|
DEFAULT_PORT,
|
15
|
-
DEFAULT_TIMEOUT,
|
16
15
|
DEFAULT_USERNAME,
|
17
16
|
DOMAIN_OBJECTS,
|
18
17
|
GATEWAY_REBOOT,
|
@@ -47,6 +46,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
47
46
|
self,
|
48
47
|
host: str,
|
49
48
|
password: str,
|
49
|
+
timeout: float,
|
50
50
|
websession: aiohttp.ClientSession,
|
51
51
|
_cooling_present: bool,
|
52
52
|
_elga: bool,
|
@@ -66,8 +66,6 @@ class SmileAPI(SmileComm, SmileData):
|
|
66
66
|
smile_type: str,
|
67
67
|
username: str = DEFAULT_USERNAME,
|
68
68
|
port: int = DEFAULT_PORT,
|
69
|
-
timeout: float = DEFAULT_TIMEOUT,
|
70
|
-
|
71
69
|
) -> None:
|
72
70
|
"""Set the constructor for this class."""
|
73
71
|
super().__init__(
|
@@ -87,6 +85,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
87
85
|
self._on_off_device = _on_off_device
|
88
86
|
self._opentherm_device = _opentherm_device
|
89
87
|
self._schedule_old_states = _schedule_old_states
|
88
|
+
self._timeout = timeout
|
90
89
|
self.gateway_id = gateway_id
|
91
90
|
self.loc_data = loc_data
|
92
91
|
self.smile_fw_version = smile_fw_version
|
@@ -149,14 +148,6 @@ class SmileAPI(SmileComm, SmileData):
|
|
149
148
|
### API Set and HA Service-related Functions ###
|
150
149
|
########################################################################################################
|
151
150
|
|
152
|
-
async def call_request(self, uri: str, **kwargs: Any) -> None:
|
153
|
-
"""ConnectionFailedError wrapper for calling _request()."""
|
154
|
-
method: str = kwargs["method"]
|
155
|
-
try:
|
156
|
-
await self._request(uri, method=method)
|
157
|
-
except ConnectionFailedError as exc:
|
158
|
-
raise ConnectionFailedError from exc
|
159
|
-
|
160
151
|
async def delete_notification(self) -> None:
|
161
152
|
"""Delete the active Plugwise Notification."""
|
162
153
|
await self.call_request(NOTIFICATIONS, method="delete")
|
@@ -189,7 +180,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
189
180
|
|
190
181
|
uri = f"{APPLIANCES};id={self._heater_id}/thermostat;id={thermostat_id}"
|
191
182
|
data = f"<thermostat_functionality><setpoint>{temp}</setpoint></thermostat_functionality>"
|
192
|
-
await self.
|
183
|
+
await self.call_request(uri, method="put", data=data)
|
193
184
|
|
194
185
|
async def set_offset(self, dev_id: str, offset: float) -> None:
|
195
186
|
"""Set the Temperature offset for thermostats that support this feature."""
|
@@ -202,7 +193,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
202
193
|
uri = f"{APPLIANCES};id={dev_id}/offset;type=temperature_offset"
|
203
194
|
data = f"<offset_functionality><offset>{value}</offset></offset_functionality>"
|
204
195
|
|
205
|
-
await self.
|
196
|
+
await self.call_request(uri, method="put", data=data)
|
206
197
|
|
207
198
|
async def set_preset(self, loc_id: str, preset: str) -> None:
|
208
199
|
"""Set the given Preset on the relevant Thermostat - from LOCATIONS."""
|
@@ -222,7 +213,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
222
213
|
f"</type><preset>{preset}</preset></location></locations>"
|
223
214
|
)
|
224
215
|
|
225
|
-
await self.
|
216
|
+
await self.call_request(uri, method="put", data=data)
|
226
217
|
|
227
218
|
async def set_select(self, key: str, loc_id: str, option: str, state: str | None) -> None:
|
228
219
|
"""Set a dhw/gateway/regulation mode or the thermostat schedule option."""
|
@@ -245,7 +236,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
245
236
|
uri = f"{APPLIANCES};type=heater_central/domestic_hot_water_mode_control"
|
246
237
|
data = f"<domestic_hot_water_mode_control_functionality><mode>{mode}</mode></domestic_hot_water_mode_control_functionality>"
|
247
238
|
|
248
|
-
await self.
|
239
|
+
await self.call_request(uri, method="put", data=data)
|
249
240
|
|
250
241
|
async def set_gateway_mode(self, mode: str) -> None:
|
251
242
|
"""Set the gateway mode."""
|
@@ -268,7 +259,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
268
259
|
uri = f"{APPLIANCES};id={self.gateway_id}/gateway_mode_control"
|
269
260
|
data = f"<gateway_mode_control_functionality><mode>{mode}</mode>{valid}</gateway_mode_control_functionality>"
|
270
261
|
|
271
|
-
await self.
|
262
|
+
await self.call_request(uri, method="put", data=data)
|
272
263
|
|
273
264
|
async def set_regulation_mode(self, mode: str) -> None:
|
274
265
|
"""Set the heating regulation mode."""
|
@@ -281,7 +272,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
281
272
|
duration = "<duration>300</duration>"
|
282
273
|
data = f"<regulation_mode_control_functionality>{duration}<mode>{mode}</mode></regulation_mode_control_functionality>"
|
283
274
|
|
284
|
-
await self.
|
275
|
+
await self.call_request(uri, method="put", data=data)
|
285
276
|
|
286
277
|
async def set_schedule_state(
|
287
278
|
self,
|
@@ -335,7 +326,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
335
326
|
f"{template}{contexts}</rule></rules>"
|
336
327
|
)
|
337
328
|
|
338
|
-
await self.
|
329
|
+
await self.call_request(uri, method="put", data=data)
|
339
330
|
self._schedule_old_states[loc_id][name] = new_state
|
340
331
|
|
341
332
|
def determine_contexts(
|
@@ -404,7 +395,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
404
395
|
if self._domain_objects.find(locator).text == "true":
|
405
396
|
raise PlugwiseError("Plugwise: the locked Relay was not switched.")
|
406
397
|
|
407
|
-
await self.
|
398
|
+
await self.call_request(uri, method="put", data=data)
|
408
399
|
|
409
400
|
async def _set_groupswitch_member_state(
|
410
401
|
self, members: list[str], state: str, switch: Munch
|
@@ -419,7 +410,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
419
410
|
uri = f"{APPLIANCES};id={member}/{switch.device};id={switch_id}"
|
420
411
|
data = f"<{switch.func_type}><{switch.func}>{state}</{switch.func}></{switch.func_type}>"
|
421
412
|
|
422
|
-
await self.
|
413
|
+
await self.call_request(uri, method="put", data=data)
|
423
414
|
|
424
415
|
async def set_temperature(self, loc_id: str, items: dict[str, float]) -> None:
|
425
416
|
"""Set the given Temperature on the relevant Thermostat."""
|
@@ -460,4 +451,13 @@ class SmileAPI(SmileComm, SmileData):
|
|
460
451
|
f"{temperature}</setpoint></thermostat_functionality>"
|
461
452
|
)
|
462
453
|
|
463
|
-
await self.
|
454
|
+
await self.call_request(uri, method="put", data=data)
|
455
|
+
|
456
|
+
async def call_request(self, uri: str, **kwargs: Any) -> None:
|
457
|
+
"""ConnectionFailedError wrapper for calling _request()."""
|
458
|
+
method: str = kwargs["method"]
|
459
|
+
data: str | None = kwargs.get("data")
|
460
|
+
try:
|
461
|
+
await self._request(uri, method=method, data=data)
|
462
|
+
except ConnectionFailedError as exc:
|
463
|
+
raise ConnectionFailedError from exc
|
@@ -0,0 +1,17 @@
|
|
1
|
+
plugwise/__init__.py,sha256=EXiTp-N8kQqOUAaczDbULS176NwA2C1FcfWiKkBzNdI,16887
|
2
|
+
plugwise/common.py,sha256=P4sUYzgVcFsIR2DmQxeVeOiZvFZWpZXgwHA3XRc1Sx0,12538
|
3
|
+
plugwise/constants.py,sha256=Y8DeuZSK2_2ZDPMwFtlGkNZKvqaE-WYl-s4fZsj4XZ4,16681
|
4
|
+
plugwise/data.py,sha256=HA3OoLrTad4ytns6_rfygwu8eGfopHJBNADGs-hvaQk,9054
|
5
|
+
plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
|
6
|
+
plugwise/helper.py,sha256=NFcxVtY9qdM2TtBbGs-_eh7xKO6G_M3Q4W9bXUCpH84,43861
|
7
|
+
plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
+
plugwise/smile.py,sha256=UT983eZeeD6JjsgOTDWmzvCfCosYilS5ojBHf6m53_U,18609
|
9
|
+
plugwise/util.py,sha256=9ld46KJHWFze2eUrVSgUYn0g3zNerlpboM0iUa0H3ak,7830
|
10
|
+
plugwise/legacy/data.py,sha256=DsHR9xgiFDg_Vh_6ZpOskw8ZhNQ3CmwjstI3yiH6MEk,3048
|
11
|
+
plugwise/legacy/helper.py,sha256=6-tYQMEXepE5rec-hn6lt2EeknADI3J8UFuBSLgu8dk,17878
|
12
|
+
plugwise/legacy/smile.py,sha256=7oaPZuvxrYRvoA8qWFvtWSwQRFfQl1XXpPjWXn3_xFs,11314
|
13
|
+
plugwise-0.38.2.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
|
14
|
+
plugwise-0.38.2.dist-info/METADATA,sha256=yLwO_H9Xd5lEIYX4ImZnm0l0yGxoZN47XtVsdIpsbj4,9098
|
15
|
+
plugwise-0.38.2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
16
|
+
plugwise-0.38.2.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
|
17
|
+
plugwise-0.38.2.dist-info/RECORD,,
|
plugwise-0.38.0.dist-info/RECORD
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
plugwise/__init__.py,sha256=yJu-PvXj2gov6G85fCptfNAbMkAb_tMfiv8Uc9PgnQ8,14936
|
2
|
-
plugwise/common.py,sha256=P4sUYzgVcFsIR2DmQxeVeOiZvFZWpZXgwHA3XRc1Sx0,12538
|
3
|
-
plugwise/constants.py,sha256=aP2ifDFIRuzYzuhJk1cOdqN84yR135eqCzAATrhxMo4,16646
|
4
|
-
plugwise/data.py,sha256=HA3OoLrTad4ytns6_rfygwu8eGfopHJBNADGs-hvaQk,9054
|
5
|
-
plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
|
6
|
-
plugwise/helper.py,sha256=ctx5VbM9xQpNzHfL03WDP3H0yhhpC3MPI08LnhVUPxQ,43714
|
7
|
-
plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
plugwise/smile.py,sha256=Dldh70NxbOrOPY6sIV79lb4YADsUOVR1vXr8m98aWd4,18520
|
9
|
-
plugwise/util.py,sha256=9ld46KJHWFze2eUrVSgUYn0g3zNerlpboM0iUa0H3ak,7830
|
10
|
-
plugwise/legacy/data.py,sha256=DsHR9xgiFDg_Vh_6ZpOskw8ZhNQ3CmwjstI3yiH6MEk,3048
|
11
|
-
plugwise/legacy/helper.py,sha256=6-tYQMEXepE5rec-hn6lt2EeknADI3J8UFuBSLgu8dk,17878
|
12
|
-
plugwise/legacy/smile.py,sha256=O8LzM1yCfdu2tiebUcm73bd7f39PIjGbwMxgDeZ_FkE,10864
|
13
|
-
plugwise-0.38.0.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
|
14
|
-
plugwise-0.38.0.dist-info/METADATA,sha256=5VGoiUgUS66yHXqvzJNupesOviaRbtyxS1z3OUMcnCs,9098
|
15
|
-
plugwise-0.38.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
16
|
-
plugwise-0.38.0.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
|
17
|
-
plugwise-0.38.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|