python-broadlink 1.0.5__py3-none-any.whl → 1.0.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.
broadlink/__init__.py CHANGED
@@ -116,9 +116,9 @@ SUPPORTED_TYPES = {
116
116
  0x27A6: ("RM plus", "Broadlink"),
117
117
  0x27A9: ("RM pro+", "Broadlink"),
118
118
  0x27C3: ("RM pro+", "Broadlink"),
119
- # The RM Max answers the RM pro framing; the RM4 framing (length
120
- # prefix) gets "device is locked" from it. Tested on hardware in
121
- # upstream #838, whose text says rm4pro but whose diff says rmpro.
119
+ # Mapping follows the diff in upstream #838 (its text says rm4pro,
120
+ # its diff says rmpro). Testers in that thread reported the device
121
+ # answering "locked" on auth, so treat it as reported, not confirmed.
122
122
  0xAF8B: ("RM Max", "Broadlink"),
123
123
  },
124
124
  rmminib: {
broadlink/device.py CHANGED
@@ -120,7 +120,14 @@ async def _open_endpoint(
120
120
  remote_addr: tuple[str, int] | None = None,
121
121
  broadcast: bool = False,
122
122
  ) -> tuple[asyncio.DatagramTransport, _Protocol]:
123
- """Create a UDP endpoint. Tests replace this to fake the network."""
123
+ """Create a UDP endpoint. Tests replace this to fake the network.
124
+
125
+ An endpoint with no address on either side is bound to ``0.0.0.0``
126
+ explicitly; the proactor loop on Windows starts receiving as soon as the
127
+ endpoint exists, which needs a bound socket.
128
+ """
129
+ if local_addr is None and remote_addr is None:
130
+ local_addr = ("0.0.0.0", 0)
124
131
  loop = asyncio.get_running_loop()
125
132
  transport, protocol = await loop.create_datagram_endpoint(
126
133
  _Protocol,
@@ -643,6 +650,11 @@ class Device:
643
650
  if self._auth_generation == generation:
644
651
  try:
645
652
  await self.auth()
653
+ except (e.NetworkTimeoutError, e.EndpointClosedError):
654
+ # A network failure during re-authentication is
655
+ # reported as what it is, not as the device's
656
+ # original expired-key answer.
657
+ raise
646
658
  except e.BroadlinkException as err:
647
659
  _LOGGER.debug(
648
660
  "%s: re-authentication failed: %s", self.host[0], err
broadlink/remote.py CHANGED
@@ -408,7 +408,7 @@ class rmmini(Device):
408
408
  except ValueError as err:
409
409
  # A packet the device returned but we cannot decode. Log
410
410
  # it, re-arm and keep the window open.
411
- _LOGGER.warning(
411
+ _LOGGER.debug(
412
412
  "%s: ignoring an undecodable capture (%s): %s",
413
413
  self.host[0],
414
414
  err,
@@ -500,10 +500,12 @@ class rmpro(rmmini):
500
500
  raise ValueError("window must be 0 or positive, poll_interval positive")
501
501
  await self._claim_window()
502
502
  try:
503
- async for signal in self._capture_rf_body(
503
+ body = self._capture_rf_body(
504
504
  window, frequency, stop_after_first, poll_interval, rearm_interval
505
- ):
506
- yield signal
505
+ )
506
+ async with contextlib.aclosing(body):
507
+ async for signal in body:
508
+ yield signal
507
509
  finally:
508
510
  self._release_window()
509
511
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: python-broadlink
3
- Version: 1.0.5
3
+ Version: 1.0.6
4
4
  Summary: Python API for controlling Broadlink devices
5
5
  Author: DAB-LABS
6
6
  Author-email: Matthew Garrett <mjg59@srcf.ucam.org>
@@ -1,19 +1,19 @@
1
- broadlink/__init__.py,sha256=OJCaOs_IOgLqdaVe4bH3ALQEs-IVFV3lGFd5da7o2w4,11138
1
+ broadlink/__init__.py,sha256=zlf8v225DdjvT_yDELRPAsQcAC4e5rrdlP0nyTBL7ms,11145
2
2
  broadlink/alarm.py,sha256=tmeNI-AaPna5nbgoTqz_AGmuQVItGTmt7zyNiRLsSlQ,1260
3
3
  broadlink/climate.py,sha256=fciXwQ0P2_kOaJiXAprfXuDyhLdHU--mE6pCYkVWdF8,15592
4
4
  broadlink/const.py,sha256=Y0XSxYr1k27FKqHWBirJsUB0HGxQ1riIZ9rfVEJaIL4,120
5
5
  broadlink/cover.py,sha256=-wW1BPmf5Z8oeLuqDVEpUyU-PgId5CJ91M3g3RjgVAU,5448
6
- broadlink/device.py,sha256=Y3uzlrZ0CaAIhpNO7ap4DvKlLpqNQVKp9kXjcKxTqRI,25786
6
+ broadlink/device.py,sha256=Noy3Uj_7XfFDhgH92C1GM4smdRK_2-VR-aP6f3PjKAY,26378
7
7
  broadlink/exceptions.py,sha256=S8xOGdzyFGd6ULXUlblDwE-MADoJIR49itEo0j_fZNU,5226
8
8
  broadlink/helpers.py,sha256=Zbw7lNRMB08P5FPAtKMJLExBjts_Gq64tJbR7-JwxX8,1294
9
9
  broadlink/hub.py,sha256=e78lDKcdtDNqSOZkQRqLMPMFR0PgT2g3E7VgULCq-QM,2869
10
10
  broadlink/light.py,sha256=fWCoaf6JmDfcc7ggRmehss9D3cp66evUDlcB50Iu2LI,7660
11
11
  broadlink/protocol.py,sha256=eRCm0fGdApVp5ko_fOP79lazQklda8N6x30ty6P0TiA,1848
12
- broadlink/remote.py,sha256=sXDvBneN5dppAyMi3-d1ysVPu6-tF1ugHMzpBEMr-_E,22382
12
+ broadlink/remote.py,sha256=t0CBCrzbUuA1wX066odpPuQSnkppcPnJSBV6oDYDeMo,22462
13
13
  broadlink/sensor.py,sha256=Pa4fJnG28wPFIf7HSN4JQ3cIOfAdTCu5I0spnBG12Qg,2791
14
14
  broadlink/switch.py,sha256=0VurdoGf3CTrYBSQU4ahVSLC_FYHqIRWr3dLkBwIatI,14985
15
- python_broadlink-1.0.5.dist-info/licenses/LICENSE,sha256=h0N_LWq34pY0W-Ky3ayO6Re5ejG0XvutPlW-GL8eG5I,1111
16
- python_broadlink-1.0.5.dist-info/METADATA,sha256=h7AZlQhasZUDjRbtIEB_JmUAsRPIkf7gsUXl7fb3QvA,15948
17
- python_broadlink-1.0.5.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
18
- python_broadlink-1.0.5.dist-info/top_level.txt,sha256=_Qx7d8oNTOLeDkAN-HHDoq1FlRNlsiaMZlyMWgHXAVc,10
19
- python_broadlink-1.0.5.dist-info/RECORD,,
15
+ python_broadlink-1.0.6.dist-info/licenses/LICENSE,sha256=h0N_LWq34pY0W-Ky3ayO6Re5ejG0XvutPlW-GL8eG5I,1111
16
+ python_broadlink-1.0.6.dist-info/METADATA,sha256=B8Qv617UFdGn6gustQIUxRdlY2b1qSwHYHHnuiN5rSA,15948
17
+ python_broadlink-1.0.6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
18
+ python_broadlink-1.0.6.dist-info/top_level.txt,sha256=_Qx7d8oNTOLeDkAN-HHDoq1FlRNlsiaMZlyMWgHXAVc,10
19
+ python_broadlink-1.0.6.dist-info/RECORD,,