python-izone 1.3.5__py3-none-any.whl → 1.3.6__py3-none-any.whl

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.
pizone/__init__.py CHANGED
@@ -29,7 +29,6 @@ from types import ModuleType
29
29
  from typing import Any
30
30
 
31
31
  from . import power as power_mod
32
- from .const import PLACEHOLDER_DEVICE_UID
33
32
  from .controller import Controller
34
33
  from .discovery import DiscoveryService, Listener, create_discovery, discovery
35
34
  from .exceptions import ControllerCommandError, ResponseDecodeError, UnpairedBridgeError
@@ -60,7 +59,6 @@ sys.modules[__name__].__class__ = _PizoneModule
60
59
 
61
60
  __all__ = [
62
61
  "ENABLE_POWER",
63
- "PLACEHOLDER_DEVICE_UID",
64
62
  "BatteryLevel",
65
63
  "Controller",
66
64
  "ControllerCommandError",
pizone/discovery.py CHANGED
@@ -50,7 +50,7 @@ DISCOVERY_RESCAN = 20.0
50
50
  RESCAN_COOLDOWN = 5.0
51
51
 
52
52
  # disposition: 1.4 — active discover_by_uid / discover_all wait
53
- SCAN_TIMEOUT = 20.0
53
+ SCAN_TIMEOUT = 5.0
54
54
 
55
55
  _LOG = logging.getLogger("pizone.discovery")
56
56
 
@@ -756,8 +756,13 @@ class DiscoveryService:
756
756
  return
757
757
  _LOG.info("Close called on discovery service.")
758
758
  self._close_task = current
759
- if self._transport:
759
+ if self._transport is not None:
760
+ # DatagramTransport.close() only schedules sock release via
761
+ # call_soon(_call_connection_lost). Wait until connection_lost
762
+ # clears _transport so a following create_discovery can bind :7005.
760
763
  self._transport.close()
764
+ while self._transport is not None:
765
+ await asyncio.sleep(0)
761
766
 
762
767
  pending = [task for task in list(self._tasks) if task is not current]
763
768
  for task in pending:
@@ -773,6 +778,7 @@ class DiscoveryService:
773
778
 
774
779
  def _on_connection_lost(self, exc: Exception | None) -> None:
775
780
  _LOG.debug("Connection Lost")
781
+ self._transport = None
776
782
  if not self._close_task:
777
783
  _LOG.error("Connection Lost unexpectedly: %s", repr(exc))
778
784
  self.create_task(self.close())
@@ -1002,5 +1008,12 @@ async def create_discovery(
1002
1008
  on_endpoint_discovered=on_endpoint_discovered,
1003
1009
  )
1004
1010
  _active_discovery = service
1005
- await service.start_discovery()
1011
+ try:
1012
+ await service.start_discovery()
1013
+ except BaseException:
1014
+ # close() clears the global when it finishes; clear again if close never ran.
1015
+ with suppress(BaseException):
1016
+ await service.close()
1017
+ _clear_discovery_global(service)
1018
+ raise
1006
1019
  return service
pizone/version.py CHANGED
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '1.3.5'
22
- __version_tuple__ = version_tuple = (1, 3, 5)
21
+ __version__ = version = '1.3.6'
22
+ __version_tuple__ = version_tuple = (1, 3, 6)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-izone
3
- Version: 1.3.5
3
+ Version: 1.3.6
4
4
  Summary: A python interface to the iZone airconditioner controller
5
5
  Project-URL: Homepage, https://github.com/Swamp-Ig/pizone
6
6
  Author-email: Penny Wood <pypl@ninjateaparty.com>
@@ -1,14 +1,14 @@
1
- pizone/__init__.py,sha256=IAZBU-UVisaiR2oHEVcLCRzuxieyU57xZ70uPjgsSLw,2627
1
+ pizone/__init__.py,sha256=yJMEJCKBU0mYOuvvBZFG5NTkpMpMWBAg9MvmzP3npK8,2555
2
2
  pizone/const.py,sha256=0skTh6zBe61AJ_57fqdBrxz3aVBM3T4Ak_cPSkOx2Bo,153
3
3
  pizone/controller.py,sha256=nctzAF8Y75T0_Ue9Hxxv9OfEex4zoNseOMjGfI6wHFE,41109
4
- pizone/discovery.py,sha256=vMdOunGrVS1ZWOgUAmm-dLdUOM9blGPKUcYr7683IV4,36659
4
+ pizone/discovery.py,sha256=C9AEK6nMyo2xU-jZ3BWyADnTMM-X1EkgNh9LaECkpBc,37266
5
5
  pizone/exceptions.py,sha256=wRO-COpyNyKL6P1vG0MlAVwbwo2iOvH0kRO7O75PUlo,1327
6
6
  pizone/power.py,sha256=bXoDRVD6gCfq0kJv132sjfy13DHGd6p2uBg9HcxRSxA,10343
7
7
  pizone/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  pizone/types.py,sha256=fZrnec0Q815HyG2sFciLqNX0QDbTq1_0wTF92GXQh78,200
9
- pizone/version.py,sha256=8n48nP6UfUYjAJjgHmQr6-hzX4qoTllJ-v-32sLOJbA,520
9
+ pizone/version.py,sha256=_FUKw5XE-1Iz4eIZxskUWzdnDjBxzXHPurN7TvxgxV8,520
10
10
  pizone/zone.py,sha256=tqiLJAJCmp1cehCtVPjawUNY9qyYypC4x3igI5jtDNo,7446
11
- python_izone-1.3.5.dist-info/METADATA,sha256=u7byaXu4JhVKdbSZrYupB1xdy6MAYBAzSR_IPostzgU,2703
12
- python_izone-1.3.5.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
13
- python_izone-1.3.5.dist-info/licenses/licence.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
- python_izone-1.3.5.dist-info/RECORD,,
11
+ python_izone-1.3.6.dist-info/METADATA,sha256=nv6-HMl-Py3IKlUPtstcKfpEz1LbsmOZGF1P0oOy8ao,2703
12
+ python_izone-1.3.6.dist-info/WHEEL,sha256=lCkmxWfQsSc9CfIClYeavTdQeEX2toPqufh9gI35EQA,87
13
+ python_izone-1.3.6.dist-info/licenses/licence.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
+ python_izone-1.3.6.dist-info/RECORD,,