55from __future__ import annotations
66
77from plugwise .constants import (
8+ DEFAULT_LEGACY_TIMEOUT ,
89 DEFAULT_PORT ,
910 DEFAULT_TIMEOUT ,
1011 DEFAULT_USERNAME ,
@@ -46,7 +47,7 @@ def __init__(
4647 websession : aiohttp .ClientSession ,
4748 username : str = DEFAULT_USERNAME ,
4849 port : int = DEFAULT_PORT ,
49- timeout : float = DEFAULT_TIMEOUT ,
50+ timeout : float = DEFAULT_LEGACY_TIMEOUT ,
5051
5152 ) -> None :
5253 """Set the constructor for this class."""
@@ -128,6 +129,7 @@ async def connect(self) -> bool:
128129 self ._smile_api = SmileAPI (
129130 self ._host ,
130131 self ._passwd ,
132+ self ._timeout ,
131133 self ._websession ,
132134 self ._cooling_present ,
133135 self ._elga ,
@@ -147,10 +149,10 @@ async def connect(self) -> bool:
147149 self .smile_type ,
148150 self ._user ,
149151 self ._port ,
150- self ._timeout ,
151152 ) if not self .smile_legacy else SmileLegacyAPI (
152153 self ._host ,
153154 self ._passwd ,
155+ self ._timeout ,
154156 self ._websession ,
155157 self ._is_thermostat ,
156158 self ._on_off_device ,
@@ -168,7 +170,6 @@ async def connect(self) -> bool:
168170 self .smile_zigbee_mac_address ,
169171 self ._user ,
170172 self ._port ,
171- self ._timeout ,
172173 )
173174
174175 # Update all endpoints on first connect
@@ -192,6 +193,9 @@ async def _smile_detect(self, result: etree, dsmrmain: etree) -> None:
192193 else :
193194 model = await self ._smile_detect_legacy (result , dsmrmain , model )
194195
196+ if not self .smile_legacy :
197+ self ._timeout = DEFAULT_TIMEOUT
198+
195199 if model == "Unknown" or self .smile_fw_version is None : # pragma: no cover
196200 # Corner case check
197201 LOGGER .error (
0 commit comments