plugwise 1.4.2a2__py3-none-any.whl → 1.4.3__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 CHANGED
@@ -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._timeout,
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._timeout,
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(
plugwise/legacy/smile.py CHANGED
@@ -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(SmileComm, SmileLegacyData):
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
- timeout: int,
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._request(DOMAIN_OBJECTS)
95
- self._locations = await self._request(LOCATIONS)
96
- self._modules = await self._request(MODULES)
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._request(APPLIANCES)
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._request(DOMAIN_OBJECTS)
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._request(MODULES)
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._request(APPLIANCES)
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 _request()."""
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._request(uri, method=method, data=data)
290
+ await self.request(uri, method=method, data=data)
299
291
  except ConnectionFailedError as exc:
300
292
  raise ConnectionFailedError from exc
plugwise/smile.py CHANGED
@@ -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(SmileComm, SmileData):
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
- timeout: int,
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._request(DOMAIN_OBJECTS)
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 _request()."""
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._request(uri, method=method, data=data)
460
+ await self.request(uri, method=method, data=data)
469
461
  except ConnectionFailedError as exc:
470
462
  raise ConnectionFailedError from exc
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: plugwise
3
- Version: 1.4.2a2
3
+ Version: 1.4.3
4
4
  Summary: Plugwise Smile (Adam/Anna/P1) and Stretch module for Python 3.
5
5
  Home-page: https://github.com/plugwise/python-plugwise
6
6
  Author: Plugwise device owners
@@ -1,17 +1,17 @@
1
- plugwise/__init__.py,sha256=QeUbOAPOcSOGIpB8YYjrJZB9O4-fTU7Gy0Q6aUD5rn4,16980
1
+ plugwise/__init__.py,sha256=tv6B4s9TQAsmKhqiXpyGuszjfcP7wNRx_EFoorBevwA,16848
2
2
  plugwise/common.py,sha256=WltDqYlW5D3KqIcm5U_gVY4izLZSk_Uk-MEJl6RDNbs,12592
3
3
  plugwise/constants.py,sha256=kVNrr4zeKFMiGBogVLZ6B925FHAIgy1PY2BBxaT1vkk,16742
4
4
  plugwise/data.py,sha256=I4w3ABqmcj_uSnfxTWPYQH8WP6HaywVMx1aQ-feBdU0,10734
5
5
  plugwise/exceptions.py,sha256=Ce-tO9uNsMB-8FP6VAxBvsHNJ-NIM9F0onUZOdZI4Ys,1110
6
6
  plugwise/helper.py,sha256=uOmxYr4ic1F8nYLHb1c1dC7-WphM82VT9vMLQet3CU8,44418
7
7
  plugwise/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- plugwise/smile.py,sha256=5johCmwFuAHbTf05lWpdZ4WaUhVzt9Vb7bksSbFVeq4,18827
8
+ plugwise/smile.py,sha256=x0BrEUMcW0oBAwgdr0qUvesoGvlHojgV96OxD2HdXd0,18687
9
9
  plugwise/util.py,sha256=u2qQt6ubQW1ioiDIIzOMnyydxQH5_48_Tbw_vEgCpyg,8161
10
10
  plugwise/legacy/data.py,sha256=DsHR9xgiFDg_Vh_6ZpOskw8ZhNQ3CmwjstI3yiH6MEk,3048
11
11
  plugwise/legacy/helper.py,sha256=DjdyU5kwXg4N5ZU9H65w7MSUY6SADcaAy_OziyFKDis,18311
12
- plugwise/legacy/smile.py,sha256=GFmeceLb4zTx4K7EP-7QMqHSkNvnzEq7GtCWhR55YbE,11313
13
- plugwise-1.4.2a2.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
14
- plugwise-1.4.2a2.dist-info/METADATA,sha256=230yidtaThgZzQEsnHBIx3_ddYS6URLrdYA0xQUAeWM,9099
15
- plugwise-1.4.2a2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
16
- plugwise-1.4.2a2.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
17
- plugwise-1.4.2a2.dist-info/RECORD,,
12
+ plugwise/legacy/smile.py,sha256=Rg4MX5hbCddrG03BWiCxzRWmAq4-_31Li45T6w79z8U,11166
13
+ plugwise-1.4.3.dist-info/LICENSE,sha256=mL22BjmXtg_wnoDnnaqps5_Bg_VGj_yHueX5lsKwbCc,1144
14
+ plugwise-1.4.3.dist-info/METADATA,sha256=hznYuWl93GPYl2H5UQcFv-fGquL7YnAd3l0LwxqflGw,9097
15
+ plugwise-1.4.3.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
16
+ plugwise-1.4.3.dist-info/top_level.txt,sha256=MYOmktMFf8ZmX6_OE1y9MoCZFfY-L8DA0F2tA2IvE4s,9
17
+ plugwise-1.4.3.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5