plugwise 1.4.2__tar.gz → 1.4.3__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.
- {plugwise-1.4.2 → plugwise-1.4.3}/PKG-INFO +1 -1
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/__init__.py +2 -7
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/legacy/smile.py +13 -21
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/smile.py +7 -15
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise.egg-info/PKG-INFO +1 -1
- {plugwise-1.4.2 → plugwise-1.4.3}/pyproject.toml +1 -1
- {plugwise-1.4.2 → plugwise-1.4.3}/LICENSE +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/README.md +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/common.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/constants.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/data.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/exceptions.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/helper.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/legacy/data.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/legacy/helper.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/py.typed +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise/util.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise.egg-info/SOURCES.txt +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise.egg-info/dependency_links.txt +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise.egg-info/requires.txt +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/plugwise.egg-info/top_level.txt +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/setup.cfg +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/setup.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_adam.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_anna.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_generic.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_init.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_legacy_anna.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_legacy_generic.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_legacy_p1.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_legacy_stretch.py +0 -0
- {plugwise-1.4.2 → plugwise-1.4.3}/tests/test_p1.py +0 -0
@@ -6,7 +6,6 @@ from __future__ import annotations
|
|
6
6
|
|
7
7
|
from plugwise.constants import (
|
8
8
|
DEFAULT_PORT,
|
9
|
-
DEFAULT_TIMEOUT,
|
10
9
|
DEFAULT_USERNAME,
|
11
10
|
DOMAIN_OBJECTS,
|
12
11
|
LOGGER,
|
@@ -61,7 +60,6 @@ class Smile(SmileComm):
|
|
61
60
|
self._host = host
|
62
61
|
self._passwd = password
|
63
62
|
self._port = port
|
64
|
-
self._timeout = timeout
|
65
63
|
self._user = username
|
66
64
|
self._websession = websession
|
67
65
|
|
@@ -128,7 +126,7 @@ class Smile(SmileComm):
|
|
128
126
|
self._smile_api = SmileAPI(
|
129
127
|
self._host,
|
130
128
|
self._passwd,
|
131
|
-
self.
|
129
|
+
self._request,
|
132
130
|
self._websession,
|
133
131
|
self._cooling_present,
|
134
132
|
self._elga,
|
@@ -152,7 +150,7 @@ class Smile(SmileComm):
|
|
152
150
|
) if not self.smile_legacy else SmileLegacyAPI(
|
153
151
|
self._host,
|
154
152
|
self._passwd,
|
155
|
-
self.
|
153
|
+
self._request,
|
156
154
|
self._websession,
|
157
155
|
self._is_thermostat,
|
158
156
|
self._on_off_device,
|
@@ -194,9 +192,6 @@ class Smile(SmileComm):
|
|
194
192
|
else:
|
195
193
|
model = await self._smile_detect_legacy(result, dsmrmain, model)
|
196
194
|
|
197
|
-
if not self.smile_legacy:
|
198
|
-
self._timeout = DEFAULT_TIMEOUT
|
199
|
-
|
200
195
|
if model == "Unknown" or self.smile_fw_version is None: # pragma: no cover
|
201
196
|
# Corner case check
|
202
197
|
LOGGER.error(
|
@@ -4,6 +4,7 @@ Plugwise backend module for Home Assistant Core - covering the legacy P1, Anna,
|
|
4
4
|
"""
|
5
5
|
from __future__ import annotations
|
6
6
|
|
7
|
+
from collections.abc import Awaitable, Callable
|
7
8
|
import datetime as dt
|
8
9
|
from typing import Any
|
9
10
|
|
@@ -24,14 +25,13 @@ from plugwise.constants import (
|
|
24
25
|
ThermoLoc,
|
25
26
|
)
|
26
27
|
from plugwise.exceptions import ConnectionFailedError, PlugwiseError
|
27
|
-
from plugwise.helper import SmileComm
|
28
28
|
from plugwise.legacy.data import SmileLegacyData
|
29
29
|
|
30
30
|
import aiohttp
|
31
31
|
from munch import Munch
|
32
32
|
|
33
33
|
|
34
|
-
class SmileLegacyAPI(
|
34
|
+
class SmileLegacyAPI(SmileLegacyData):
|
35
35
|
"""The Plugwise SmileLegacyAPI class."""
|
36
36
|
|
37
37
|
# pylint: disable=too-many-instance-attributes, too-many-public-methods
|
@@ -40,7 +40,7 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
40
40
|
self,
|
41
41
|
host: str,
|
42
42
|
password: str,
|
43
|
-
|
43
|
+
request: Callable[..., Awaitable[Any]],
|
44
44
|
websession: aiohttp.ClientSession,
|
45
45
|
_is_thermostat: bool,
|
46
46
|
_on_off_device: bool,
|
@@ -60,14 +60,6 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
60
60
|
username: str = DEFAULT_USERNAME,
|
61
61
|
) -> None:
|
62
62
|
"""Set the constructor for this class."""
|
63
|
-
super().__init__(
|
64
|
-
host,
|
65
|
-
password,
|
66
|
-
port,
|
67
|
-
timeout,
|
68
|
-
username,
|
69
|
-
websession,
|
70
|
-
)
|
71
63
|
SmileLegacyData.__init__(self)
|
72
64
|
|
73
65
|
self._cooling_present = False
|
@@ -76,8 +68,8 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
76
68
|
self._opentherm_device = _opentherm_device
|
77
69
|
self._stretch_v2 = _stretch_v2
|
78
70
|
self._target_smile = _target_smile
|
79
|
-
self._timeout = timeout
|
80
71
|
self.loc_data = loc_data
|
72
|
+
self.request = request
|
81
73
|
self.smile_fw_version = smile_fw_version
|
82
74
|
self.smile_hostname = smile_hostname
|
83
75
|
self.smile_hw_version = smile_hw_version
|
@@ -91,12 +83,12 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
91
83
|
|
92
84
|
async def full_update_device(self) -> None:
|
93
85
|
"""Perform a first fetch of all XML data, needed for initialization."""
|
94
|
-
self._domain_objects = await self.
|
95
|
-
self._locations = await self.
|
96
|
-
self._modules = await self.
|
86
|
+
self._domain_objects = await self.request(DOMAIN_OBJECTS)
|
87
|
+
self._locations = await self.request(LOCATIONS)
|
88
|
+
self._modules = await self.request(MODULES)
|
97
89
|
# P1 legacy has no appliances
|
98
90
|
if self.smile_type != "power":
|
99
|
-
self._appliances = await self.
|
91
|
+
self._appliances = await self.request(APPLIANCES)
|
100
92
|
|
101
93
|
def get_all_devices(self) -> None:
|
102
94
|
"""Determine the evices present from the obtained XML-data.
|
@@ -131,12 +123,12 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
131
123
|
self.get_all_devices()
|
132
124
|
# Otherwise perform an incremental update
|
133
125
|
else:
|
134
|
-
self._domain_objects = await self.
|
126
|
+
self._domain_objects = await self.request(DOMAIN_OBJECTS)
|
135
127
|
match self._target_smile:
|
136
128
|
case "smile_v2":
|
137
|
-
self._modules = await self.
|
129
|
+
self._modules = await self.request(MODULES)
|
138
130
|
case self._target_smile if self._target_smile in REQUIRE_APPLIANCES:
|
139
|
-
self._appliances = await self.
|
131
|
+
self._appliances = await self.request(APPLIANCES)
|
140
132
|
|
141
133
|
self._update_gw_devices()
|
142
134
|
|
@@ -291,10 +283,10 @@ class SmileLegacyAPI(SmileComm, SmileLegacyData):
|
|
291
283
|
await self.call_request(uri, method="put", data=data)
|
292
284
|
|
293
285
|
async def call_request(self, uri: str, **kwargs: Any) -> None:
|
294
|
-
"""ConnectionFailedError wrapper for calling
|
286
|
+
"""ConnectionFailedError wrapper for calling request()."""
|
295
287
|
method: str = kwargs["method"]
|
296
288
|
data: str | None = kwargs.get("data")
|
297
289
|
try:
|
298
|
-
await self.
|
290
|
+
await self.request(uri, method=method, data=data)
|
299
291
|
except ConnectionFailedError as exc:
|
300
292
|
raise ConnectionFailedError from exc
|
@@ -4,6 +4,7 @@ Plugwise backend module for Home Assistant Core.
|
|
4
4
|
"""
|
5
5
|
from __future__ import annotations
|
6
6
|
|
7
|
+
from collections.abc import Awaitable, Callable
|
7
8
|
import datetime as dt
|
8
9
|
from typing import Any
|
9
10
|
|
@@ -28,7 +29,6 @@ from plugwise.constants import (
|
|
28
29
|
)
|
29
30
|
from plugwise.data import SmileData
|
30
31
|
from plugwise.exceptions import ConnectionFailedError, DataMissingError, PlugwiseError
|
31
|
-
from plugwise.helper import SmileComm
|
32
32
|
|
33
33
|
import aiohttp
|
34
34
|
from defusedxml import ElementTree as etree
|
@@ -37,7 +37,7 @@ from defusedxml import ElementTree as etree
|
|
37
37
|
from munch import Munch
|
38
38
|
|
39
39
|
|
40
|
-
class SmileAPI(
|
40
|
+
class SmileAPI(SmileData):
|
41
41
|
"""The Plugwise SmileAPI helper class for actual Plugwise devices."""
|
42
42
|
|
43
43
|
# pylint: disable=too-many-instance-attributes, too-many-public-methods
|
@@ -46,7 +46,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
46
46
|
self,
|
47
47
|
host: str,
|
48
48
|
password: str,
|
49
|
-
|
49
|
+
request: Callable[..., Awaitable[Any]],
|
50
50
|
websession: aiohttp.ClientSession,
|
51
51
|
_cooling_present: bool,
|
52
52
|
_elga: bool,
|
@@ -69,14 +69,6 @@ class SmileAPI(SmileComm, SmileData):
|
|
69
69
|
username: str = DEFAULT_USERNAME,
|
70
70
|
) -> None:
|
71
71
|
"""Set the constructor for this class."""
|
72
|
-
super().__init__(
|
73
|
-
host,
|
74
|
-
password,
|
75
|
-
port,
|
76
|
-
timeout,
|
77
|
-
username,
|
78
|
-
websession,
|
79
|
-
)
|
80
72
|
SmileData.__init__(self)
|
81
73
|
|
82
74
|
self._cooling_present = _cooling_present
|
@@ -86,9 +78,9 @@ class SmileAPI(SmileComm, SmileData):
|
|
86
78
|
self._on_off_device = _on_off_device
|
87
79
|
self._opentherm_device = _opentherm_device
|
88
80
|
self._schedule_old_states = _schedule_old_states
|
89
|
-
self._timeout = timeout
|
90
81
|
self.gateway_id = gateway_id
|
91
82
|
self.loc_data = loc_data
|
83
|
+
self.request = request
|
92
84
|
self.smile_fw_version = smile_fw_version
|
93
85
|
self.smile_hostname = smile_hostname
|
94
86
|
self.smile_hw_version = smile_hw_version
|
@@ -103,7 +95,7 @@ class SmileAPI(SmileComm, SmileData):
|
|
103
95
|
|
104
96
|
async def full_update_device(self) -> None:
|
105
97
|
"""Perform a first fetch of all XML data, needed for initialization."""
|
106
|
-
self._domain_objects = await self.
|
98
|
+
self._domain_objects = await self.request(DOMAIN_OBJECTS)
|
107
99
|
self._get_plugwise_notifications()
|
108
100
|
|
109
101
|
def get_all_devices(self) -> None:
|
@@ -461,10 +453,10 @@ class SmileAPI(SmileComm, SmileData):
|
|
461
453
|
await self.call_request(uri, method="put", data=data)
|
462
454
|
|
463
455
|
async def call_request(self, uri: str, **kwargs: Any) -> None:
|
464
|
-
"""ConnectionFailedError wrapper for calling
|
456
|
+
"""ConnectionFailedError wrapper for calling request()."""
|
465
457
|
method: str = kwargs["method"]
|
466
458
|
data: str | None = kwargs.get("data")
|
467
459
|
try:
|
468
|
-
await self.
|
460
|
+
await self.request(uri, method=method, data=data)
|
469
461
|
except ConnectionFailedError as exc:
|
470
462
|
raise ConnectionFailedError from exc
|
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
|
File without changes
|