aiocomfoconnect 0.3.2__tar.gz → 0.3.3__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.3.2
3
+ Version: 0.3.3
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
@@ -86,6 +86,7 @@ $ python -m aiocomfoconnect get-property --host 192.168.1.213 1 1 8 9 # Unit 0x
86
86
  - `async set_sensor_ventmode_humidity_protection(mode)`: Set the sensor based ventilation humidity protection setting. (auto / on / off)
87
87
  - `async get_property(prop)`: Get the value of a property, e.g. `PROPERTY_RMOT_HEATING_THRESHOLD`.
88
88
  - `async get_property_constraints(prop)`: Get the raw value of a numeric property, together with the range and step size the unit accepts.
89
+ - `bridge_type`: The type of the bridge (`GatewayType.LANC`, `SEASON` or `PRO`). Discovery reports it, and a ComfoConnect Pro is also recognised once a session has started.
89
90
 
90
91
  ### Low-level API
91
92
 
@@ -69,6 +69,7 @@ $ python -m aiocomfoconnect get-property --host 192.168.1.213 1 1 8 9 # Unit 0x
69
69
  - `async set_sensor_ventmode_humidity_protection(mode)`: Set the sensor based ventilation humidity protection setting. (auto / on / off)
70
70
  - `async get_property(prop)`: Get the value of a property, e.g. `PROPERTY_RMOT_HEATING_THRESHOLD`.
71
71
  - `async get_property_constraints(prop)`: Get the raw value of a numeric property, together with the range and step size the unit accepts.
72
+ - `bridge_type`: The type of the bridge (`GatewayType.LANC`, `SEASON` or `PRO`). Discovery reports it, and a ComfoConnect Pro is also recognised once a session has started.
72
73
 
73
74
  ### Low-level API
74
75
 
@@ -13,7 +13,7 @@ from typing import Awaitable, Callable, Dict, Iterator, Optional, Set
13
13
  from google.protobuf.message import DecodeError
14
14
  from google.protobuf.message import Message as ProtobufMessage
15
15
 
16
- from .const import VENTILATION_UNIT_PRODUCT_IDS, ProductId, PdoType
16
+ from .const import VENTILATION_UNIT_PRODUCT_IDS, GatewayType, ProductId, PdoType
17
17
  from .exceptions import (
18
18
  AioComfoConnectNotConnected,
19
19
  AioComfoConnectNotReachable,
@@ -34,7 +34,7 @@ from .protobuf import zehnder_pb2
34
34
  _LOGGER = logging.getLogger(__name__)
35
35
 
36
36
  TIMEOUT = 5
37
- GATEWAY_TYPE_PRO = 2
37
+ GATEWAY_TYPE_PRO = GatewayType.PRO
38
38
 
39
39
  # How long we wait for the bridge to announce the ventilation unit before we give up.
40
40
  NODE_DISCOVERY_TIMEOUT = 5
@@ -126,6 +126,7 @@ class Bridge:
126
126
  ):
127
127
  self.host: str = host
128
128
  self.uuid: str = uuid
129
+ # One of GatewayType. Discovery reports it, and a ComfoConnect Pro also identifies itself when a session starts.
129
130
  self.bridge_type: int = bridge_type
130
131
  self._local_uuid: Optional[str] = None
131
132
 
@@ -490,15 +491,20 @@ class Bridge:
490
491
  except DecodeError as exc:
491
492
  _LOGGER.error("Failed to decode message: %s", exc)
492
493
 
493
- def cmd_start_session(self, take_over: bool = False) -> Awaitable[Message]:
494
+ async def cmd_start_session(self, take_over: bool = False) -> Message:
494
495
  """Starts the session on the device by logging in and optionally disconnecting an already existing session."""
495
496
  _LOGGER.debug("StartSessionRequest")
496
497
  # pylint: disable=no-member
497
- return self._send(
498
+ reply = await self._send(
498
499
  zehnder_pb2.StartSessionRequest,
499
500
  zehnder_pb2.GatewayOperation.StartSessionRequestType,
500
501
  {"takeover": take_over},
501
502
  )
503
+ # A ComfoConnect Pro sets the devicename of a successful session to "ccpro", a LAN C leaves it empty. This also
504
+ # tells us the type of a bridge that was connected to by IP address, without discovery.
505
+ if getattr(reply, "devicename", None) == "ccpro":
506
+ self.bridge_type = GatewayType.PRO
507
+ return reply
502
508
 
503
509
  def cmd_close_session(self) -> Awaitable[Message]:
504
510
  """Stops the current session."""
@@ -32,6 +32,14 @@ VENTILATION_UNIT_PRODUCT_IDS = (ProductId.COMFOAIRQ, ProductId.COMFOAIRFLEX)
32
32
 
33
33
 
34
34
  # PDO Types
35
+ class GatewayType:
36
+ """Defines the type of a bridge, with the values of the GatewayType in the discovery response."""
37
+
38
+ LANC = 0 # ComfoConnect LAN C
39
+ SEASON = 1 # The built-in WiFi module of a ComfoAir Flex
40
+ PRO = 2 # ComfoConnect Pro
41
+
42
+
35
43
  class PdoType:
36
44
  """Defines a PDO type."""
37
45
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "aiocomfoconnect"
3
- version = "0.3.2"
3
+ version = "0.3.3"
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