aiocomfoconnect 0.2.0__tar.gz → 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: aiocomfoconnect
3
- Version: 0.2.0
3
+ Version: 0.2.1
4
4
  Summary: aiocomfoconnect is an asyncio Python 3 library for communicating with a Zehnder ComfoAir Q350/450/600 ventilation system
5
5
  License-File: LICENSE
6
6
  Author: Michaël Arnauts
@@ -16,6 +16,7 @@ from google.protobuf.message import Message as ProtobufMessage
16
16
  from .const import VENTILATION_UNIT_PRODUCT_IDS
17
17
  from .exceptions import (
18
18
  AioComfoConnectNotConnected,
19
+ AioComfoConnectNotReachable,
19
20
  AioComfoConnectTimeout,
20
21
  ComfoConnectBadRequest,
21
22
  ComfoConnectError,
@@ -189,8 +190,13 @@ class Bridge:
189
190
  try:
190
191
  self._reader, self._writer = await asyncio.wait_for(asyncio.open_connection(self.host, self.PORT), TIMEOUT)
191
192
  except asyncio.TimeoutError as exc:
193
+ # Keep this before OSError, since TimeoutError is a subclass of it.
192
194
  _LOGGER.warning("Timeout while connecting to bridge %s", self.host)
193
195
  raise AioComfoConnectTimeout("Timeout while connecting to bridge") from exc
196
+ except OSError as exc:
197
+ # The bridge refused the connection, is gone from the network, or its hostname doesn't resolve.
198
+ _LOGGER.warning("Could not connect to bridge %s: %s", self.host, exc)
199
+ raise AioComfoConnectNotReachable(f"Could not connect to bridge: {exc}") from exc
194
200
 
195
201
  self._reference = itertools.count(1)
196
202
  self._local_uuid = uuid
@@ -31,6 +31,7 @@ from aiocomfoconnect.const import (
31
31
  )
32
32
  from aiocomfoconnect.exceptions import (
33
33
  AioComfoConnectNotConnected,
34
+ AioComfoConnectNotReachable,
34
35
  AioComfoConnectTimeout,
35
36
  ComfoConnectNotAllowed,
36
37
  VentilationUnitNotFoundException,
@@ -180,6 +181,10 @@ class ComfoConnect(Bridge):
180
181
  _LOGGER.warning("Connection timeout, retrying in 5 seconds...")
181
182
  await asyncio.sleep(5)
182
183
 
184
+ except AioComfoConnectNotReachable as exc:
185
+ _LOGGER.warning("%s. Retrying in 5 seconds...", exc)
186
+ await asyncio.sleep(5)
187
+
183
188
  except VentilationUnitNotFoundException as exc:
184
189
  _LOGGER.warning("%s, retrying in 5 seconds...", exc)
185
190
  await asyncio.sleep(5)
@@ -50,6 +50,10 @@ class AioComfoConnectTimeout(Exception):
50
50
  """An error occurred because the bridge didn't reply in time."""
51
51
 
52
52
 
53
+ class AioComfoConnectNotReachable(Exception):
54
+ """An error occurred because the bridge could not be reached, for example when it moved to another address."""
55
+
56
+
53
57
  class BridgeNotFoundException(Exception):
54
58
  """Exception raised when no bridge is found."""
55
59
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "aiocomfoconnect"
3
- version = "0.2.0"
3
+ version = "0.2.1"
4
4
  description = "aiocomfoconnect is an asyncio Python 3 library for communicating with a Zehnder ComfoAir Q350/450/600 ventilation system"
5
5
  authors = ["Michaël Arnauts <michael.arnauts@gmail.com>"]
6
6
  readme = "README.md"
File without changes