Skip to content

Commit b1965dd

Browse files
committed
Update timeout after knowing if legacy or not
1 parent c376e76 commit b1965dd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugwise/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ def __init__(
5656
websession,
5757
username,
5858
port,
59-
timeout,
59+
self._timeout,
6060
)
6161

6262
self._host = host
6363
self._passwd = password
6464
self._websession = websession
6565
self._user = username
6666
self._port = port
67+
self._timeout = timeout
6768

6869
self._cooling_present = False
6970
self._elga = False
@@ -146,6 +147,7 @@ async def connect(self) -> bool:
146147
self.smile_type,
147148
self._user,
148149
self._port,
150+
self._timeout,
149151
) if not self.smile_legacy else SmileLegacyAPI(
150152
self._host,
151153
self._passwd,
@@ -166,6 +168,7 @@ async def connect(self) -> bool:
166168
self.smile_zigbee_mac_address,
167169
self._user,
168170
self._port,
171+
self._timeout,
169172
)
170173

171174
# Update all endpoints on first connect
@@ -189,6 +192,9 @@ async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
189192
else:
190193
model = await self._smile_detect_legacy(result, dsmrmain, model)
191194

195+
if not self.smile_legacy:
196+
self._timeout = DEFAULT_TIMEOUT
197+
192198
if model == "Unknown" or self.smile_fw_version is None: # pragma: no cover
193199
# Corner case check
194200
LOGGER.error(

0 commit comments

Comments
 (0)