Skip to content

Commit f5663d7

Browse files
committed
Make timeout internal
1 parent 3fd9aeb commit f5663d7

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

plugwise/__init__.py

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
from __future__ import annotations
66

77
from plugwise.constants import (
8+
DEFAULT_LEGACY_TIMEOUT,
89
DEFAULT_PORT,
10+
DEFAULT_TIMEOUT,
911
DEFAULT_USERNAME,
1012
DOMAIN_OBJECTS,
1113
LOGGER,
@@ -43,26 +45,26 @@ def __init__(
4345
self,
4446
host: str,
4547
password: str,
46-
timeout: int,
4748
websession: aiohttp.ClientSession,
4849
port: int = DEFAULT_PORT,
50+
timeout = DEFAULT_LEGACY_TIMEOUT,
4951
username: str = DEFAULT_USERNAME,
5052
) -> None:
5153
"""Set the constructor for this class."""
52-
super().__init__(
53-
host,
54-
password,
55-
port,
56-
timeout,
57-
username,
58-
websession,
59-
)
60-
6154
self._host = host
62-
self._passwd = password
55+
self._password = password
6356
self._port = port
64-
self._user = username
57+
self._timeout = timeout
58+
self._username = username
6559
self._websession = websession
60+
super().__init__(
61+
self._host,
62+
self._password,
63+
self._port,
64+
self._timeout,
65+
self._username,
66+
self._websession,
67+
)
6668

6769
self._cooling_present = False
6870
self._elga = False
@@ -126,7 +128,7 @@ async def connect(self) -> Version | None:
126128

127129
self._smile_api = SmileAPI(
128130
self._host,
129-
self._passwd,
131+
self._password,
130132
self._request,
131133
self._websession,
132134
self._cooling_present,
@@ -147,10 +149,10 @@ async def connect(self) -> Version | None:
147149
self.smile_name,
148150
self.smile_type,
149151
self._port,
150-
self._user,
152+
self._username,
151153
) if not self.smile_legacy else SmileLegacyAPI(
152154
self._host,
153-
self._passwd,
155+
self._password,
154156
self._request,
155157
self._websession,
156158
self._is_thermostat,
@@ -168,7 +170,7 @@ async def connect(self) -> Version | None:
168170
self.smile_type,
169171
self.smile_zigbee_mac_address,
170172
self._port,
171-
self._user,
173+
self._username,
172174
)
173175

174176
# Update all endpoints on first connect
@@ -212,6 +214,9 @@ async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
212214
)
213215
raise UnsupportedDeviceError
214216

217+
if not self.smile_legacy:
218+
self._timeout = DEFAULT_TIMEOUT
219+
215220
if self._target_smile in ("smile_open_therm_v2", "smile_thermo_v3"):
216221
LOGGER.error(
217222
"Your Smile identified as %s needs a firmware update as it's firmware is severely outdated",

plugwise/helper.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ async def _create_session() -> ClientSession:
100100

101101
self._auth = BasicAuth(username, password=password)
102102
self._endpoint = f"http://{host}:{str(port)}"
103-
self._timeout = timeout
104103

105104
async def _request(
106105
self,

0 commit comments

Comments
 (0)