@@ -271,7 +271,7 @@ async def connect(self) -> bool:
271271 names : list [str ] = []
272272
273273 result : etree = await self ._request (DOMAIN_OBJECTS )
274- dsmrmain : etree | None = result .find (".//module/protocols/dsmrmain" )
274+ dsmrmain : etree = result .find (".//module/protocols/dsmrmain" )
275275
276276 vendor_names : list [etree ] = result .findall (".//module/vendor_name" )
277277 if not vendor_names :
@@ -286,7 +286,8 @@ async def connect(self) -> bool:
286286 if dsmrmain is None : # pragma: no cover
287287 LOGGER .error (
288288 "Connected but expected text not returned, \
289- we got %s" ,
289+ we got %s. Please create an issue on \
290+ http://github.com/plugwise/python-plugwise" ,
290291 result ,
291292 )
292293 raise ConnectionFailedError
@@ -326,7 +327,7 @@ async def _smile_detect_legacy(self, result, dsmrmain) -> None:
326327 # Stretch:
327328 elif network is not None :
328329 try :
329- system = await self ._request (SYSTEM )
330+ system : etree = await self ._request (SYSTEM )
330331 version = system .find (".//gateway/firmware" ).text
331332 model = system .find (".//gateway/product" ).text
332333 self .smile_hostname = system .find (".//gateway/hostname" ).text
@@ -335,36 +336,42 @@ async def _smile_detect_legacy(self, result, dsmrmain) -> None:
335336 raise ConnectionFailedError
336337 else : # pragma: no cover
337338 # No cornercase, just end of the line
338- LOGGER .error ("Connected but no gateway device information found" )
339+ LOGGER .error (
340+ "Connected but no gateway device information found, please create \
341+ an issue on http://github.com/plugwise/python-plugwise"
342+ )
339343 raise ConnectionFailedError
340344 return model , version
341345
342- async def _smile_detect (self , result , dsmrmain ):
346+ async def _smile_detect (self , result , dsmrmain ) -> None :
343347 """Helper-function for connect().
344348 Detect which type of Smile is connected.
345349 """
346- model = None
350+ model : str = None
347351 if (gateway := result .find (".//gateway" )) is not None :
348352 model = result .find (".//gateway/vendor_model" ).text
349- version = result .find (".//gateway/firmware_version" ).text
353+ version : str = result .find (".//gateway/firmware_version" ).text
350354 if gateway .find ("hostname" ) is not None :
351355 self .smile_hostname = gateway .find ("hostname" ).text
352356 else :
353357 model , version = await self ._smile_detect_legacy (result , dsmrmain )
354358
355359 if model is None or version is None : # pragma: no cover
356360 # Corner case check
357- LOGGER .error ("Unable to find model or version information" )
361+ LOGGER .error (
362+ "Unable to find model or version information, please create \
363+ an issue on http://github.com/plugwise/python-plugwise"
364+ )
358365 raise UnsupportedDeviceError
359366
360- ver = semver .VersionInfo .parse (version )
361- target_smile = f"{ model } _v{ ver .major } "
367+ ver : semver = semver .VersionInfo .parse (version )
368+ target_smile : str = f"{ model } _v{ ver .major } "
362369 LOGGER .debug ("Plugwise identified as %s" , target_smile )
363370 if target_smile not in SMILES :
364371 LOGGER .error (
365372 'Your version Smile identified as "%s" seems\
366373 unsupported by our plugin, please create an issue\
367- on http://github.com/plugwise/python-plugwise! ' ,
374+ on http://github.com/plugwise/python-plugwise' ,
368375 target_smile ,
369376 )
370377 raise UnsupportedDeviceError
0 commit comments