Skip to content

Commit d414f88

Browse files
authored
Merge pull request #188 from plugwise/fix_187
Fix for #187
2 parents 640c7f4 + 1399cd8 commit d414f88

File tree

4 files changed

+11
-15
lines changed

4 files changed

+11
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Changelog
22

3+
# v0.18.2: Smile: fix for https://github.com/plugwise/python-plugwise/issues/187
4+
35
# v0.18.1: Smile Adam: don't show vacation-preset, as not shown in the Plugwise App or on the local Adam-website
46

57
# v0.18.0: Smile: add generation of cooling-schedules

plugwise/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""Plugwise module."""
22

3-
__version__ = "0.18.1"
3+
__version__ = "0.18.2"
44

55
from plugwise.smile import Smile
66
from plugwise.stick import Stick

plugwise/helper.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@
77
import datetime as dt
88

99
# This way of importing aiohttp is because of patch/mocking in testing (aiohttp timeouts)
10-
from aiohttp import (
11-
BasicAuth,
12-
ClientResponse,
13-
ClientSession,
14-
ClientTimeout,
15-
ServerTimeoutError,
16-
)
10+
from aiohttp import BasicAuth, ClientError, ClientResponse, ClientSession, ClientTimeout
1711
from dateutil.parser import parse
1812
from defusedxml import ElementTree as etree
1913
from munch import Munch
@@ -54,9 +48,9 @@
5448
ThermoLoc,
5549
)
5650
from .exceptions import (
57-
DeviceTimeoutError,
5851
InvalidAuthentication,
5952
InvalidXMLError,
53+
PlugwiseException,
6054
ResponseError,
6155
)
6256
from .util import (
@@ -266,12 +260,12 @@ async def _request(
266260
data=data,
267261
auth=self._auth,
268262
)
269-
except ServerTimeoutError:
263+
except ClientError as err: # ClientError is an ancestor class of ServerTimeoutError
270264
if retry < 1:
271-
LOGGER.error("Timed out sending %s command to Plugwise", command)
272-
raise DeviceTimeoutError(
273-
"Plugwise timeout error, check log for more info."
274-
)
265+
LOGGER.error("Failed sending %s %s to Plugwise Smile", method, command)
266+
raise PlugwiseException(
267+
"Plugwise connection error, check log for more info."
268+
) from err
275269
return await self._request(command, retry - 1)
276270

277271
return await self._request_validate(resp, method)

tests/test_smile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3853,7 +3853,7 @@ async def test_connect_timeout(self, timeout_test):
38533853
client,
38543854
) = await self.connect_wrapper()
38553855
assert False # pragma: no cover
3856-
except pw_exceptions.DeviceTimeoutError:
3856+
except pw_exceptions.PlugwiseException:
38573857
assert True
38583858

38593859
class PlugwiseTestError(Exception):

0 commit comments

Comments
 (0)