broadlink-async 1.1.0__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.
- broadlink_async-1.1.0/CHANGELOG.md +419 -0
- broadlink_async-1.1.0/LICENSE +22 -0
- broadlink_async-1.1.0/MANIFEST.in +5 -0
- broadlink_async-1.1.0/PKG-INFO +466 -0
- broadlink_async-1.1.0/README.md +435 -0
- broadlink_async-1.1.0/TROUBLESHOOTING.md +9 -0
- broadlink_async-1.1.0/broadlink_async/__init__.py +341 -0
- broadlink_async-1.1.0/broadlink_async/alarm.py +44 -0
- broadlink_async-1.1.0/broadlink_async/climate.py +457 -0
- broadlink_async-1.1.0/broadlink_async/const.py +6 -0
- broadlink_async-1.1.0/broadlink_async/cover.py +183 -0
- broadlink_async-1.1.0/broadlink_async/device.py +665 -0
- broadlink_async-1.1.0/broadlink_async/exceptions.py +173 -0
- broadlink_async-1.1.0/broadlink_async/helpers.py +44 -0
- broadlink_async-1.1.0/broadlink_async/hub.py +96 -0
- broadlink_async-1.1.0/broadlink_async/light.py +198 -0
- broadlink_async-1.1.0/broadlink_async/protocol.py +51 -0
- broadlink_async-1.1.0/broadlink_async/remote.py +805 -0
- broadlink_async-1.1.0/broadlink_async/sensor.py +91 -0
- broadlink_async-1.1.0/broadlink_async/switch.py +472 -0
- broadlink_async-1.1.0/broadlink_async.egg-info/PKG-INFO +466 -0
- broadlink_async-1.1.0/broadlink_async.egg-info/SOURCES.txt +42 -0
- broadlink_async-1.1.0/broadlink_async.egg-info/dependency_links.txt +1 -0
- broadlink_async-1.1.0/broadlink_async.egg-info/requires.txt +6 -0
- broadlink_async-1.1.0/broadlink_async.egg-info/top_level.txt +1 -0
- broadlink_async-1.1.0/cli/README.md +156 -0
- broadlink_async-1.1.0/cli/broadlink_cli +228 -0
- broadlink_async-1.1.0/cli/broadlink_discovery +37 -0
- broadlink_async-1.1.0/protocol.md +228 -0
- broadlink_async-1.1.0/pyproject.toml +79 -0
- broadlink_async-1.1.0/setup.cfg +4 -0
- broadlink_async-1.1.0/tests/__init__.py +0 -0
- broadlink_async-1.1.0/tests/oracle/__init__.py +1 -0
- broadlink_async-1.1.0/tests/oracle/cases.py +653 -0
- broadlink_async-1.1.0/tests/oracle/fixtures.json +4099 -0
- broadlink_async-1.1.0/tests/oracle/harness.py +164 -0
- broadlink_async-1.1.0/tests/oracle/record.py +38 -0
- broadlink_async-1.1.0/tests/test_capture.py +915 -0
- broadlink_async-1.1.0/tests/test_helpers.py +109 -0
- broadlink_async-1.1.0/tests/test_loopback.py +126 -0
- broadlink_async-1.1.0/tests/test_oracle.py +83 -0
- broadlink_async-1.1.0/tests/test_realign.py +80 -0
- broadlink_async-1.1.0/tests/test_remote.py +64 -0
- broadlink_async-1.1.0/tests/test_transport.py +1046 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are recorded here. The format follows
|
|
4
|
+
Keep a Changelog; versions follow Semantic Versioning.
|
|
5
|
+
|
|
6
|
+
## 1.1.0 - 2026-10-12
|
|
7
|
+
|
|
8
|
+
A new name, so this library and the original can be installed together.
|
|
9
|
+
Also RF packets as the RM4 Pro really returns them, a way to take a device
|
|
10
|
+
out of learning mode, and capture windows that slide. Tested on an RM4 Pro
|
|
11
|
+
with a second device listening on 433.92 MHz to what it transmits.
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- An RM4 Pro RF capture (type 0xB1) that started in the middle of a pulse
|
|
16
|
+
is realigned by `check_data`, and so by `capture_rf`. Every timing was
|
|
17
|
+
shifted by one slot, so the replayed code transmitted during the gaps
|
|
18
|
+
between frames and receivers ignored it (home-assistant/core#176041).
|
|
19
|
+
The new `realign_rf_packet` drops the stray first timing only when all
|
|
20
|
+
long gaps sit on carrier-on slots; other packets are unchanged.
|
|
21
|
+
Contributed by dustinreed-info (#12).
|
|
22
|
+
- The timings of an RM4 Pro RF capture are read from offset 8. Bytes 4 to
|
|
23
|
+
7 of an 0xB1 packet hold the carrier in kHz, and `data_to_pulses` was
|
|
24
|
+
reading them as two timings of about 1.2 s and 90 ms and swallowing the
|
|
25
|
+
first two real ones. Packets built by `pulses_to_data` (0xB2, 0xD7) and
|
|
26
|
+
IR packets are read as before. Spotted by dustinreed-info in #12.
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- `rf_carrier_mhz(packet)` returns the carrier an 0xB1 packet records, and
|
|
31
|
+
`ParsedPacket.frequency_mhz` carries it. `CapturedSignal.frequency_mhz`
|
|
32
|
+
now reports the carrier recorded in the packet when there is one (the
|
|
33
|
+
device transmits on that value when the packet is sent back), and the
|
|
34
|
+
frequency the window was given or swept to otherwise.
|
|
35
|
+
- `cancel_learning()` on every RM model takes the device out of learning
|
|
36
|
+
mode, IR or RF, sweep included. It is command 0x1E, so far known here as
|
|
37
|
+
`cancel_sweep_frequency()`, which stays as the same call.
|
|
38
|
+
- `extend_on_signal` on `capture()` and `capture_rf()`: each signal
|
|
39
|
+
restarts the window's countdown, so it closes `window` seconds after the
|
|
40
|
+
last signal.
|
|
41
|
+
|
|
42
|
+
### Changed
|
|
43
|
+
|
|
44
|
+
- The library is renamed. It is published as `broadlink-async` (was
|
|
45
|
+
`python-broadlink`) and imported as `broadlink_async` (was `broadlink`).
|
|
46
|
+
The old import name was shared with the original `broadlink` package, so
|
|
47
|
+
installing either one replaced the other's files without a warning. Home
|
|
48
|
+
Assistant hit this when a custom integration still required the original
|
|
49
|
+
(home-assistant/core#184800). The two now install side by side. To move
|
|
50
|
+
over, install `broadlink-async` and change `import broadlink` to
|
|
51
|
+
`import broadlink_async`; the API is the same. Logger names follow the
|
|
52
|
+
module, so they are now `broadlink_async.*`. The repository moved to
|
|
53
|
+
DAB-LABS/broadlink-async. `python-broadlink` stays on PyPI at 1.0.6 and
|
|
54
|
+
gets no further releases.
|
|
55
|
+
- A capture window sends `cancel_learning()` when it closes, for any
|
|
56
|
+
reason, so the device stops listening instead of holding the next press
|
|
57
|
+
until its own timeout. The cancel is best-effort, waits at most two
|
|
58
|
+
seconds, and a failure is only logged. Closing during an RF sweep
|
|
59
|
+
cancels the sweep through the same call, so a sweep that times out sends
|
|
60
|
+
one cancel, not two.
|
|
61
|
+
- Docstrings no longer say an RF packet does not record its carrier, and
|
|
62
|
+
say that byte 1 of an 0xB1 packet is not a repeat count.
|
|
63
|
+
|
|
64
|
+
## 1.0.6 - 2026-09-06
|
|
65
|
+
|
|
66
|
+
Small items from a sixth review, of 1.0.5, which found no defect in the
|
|
67
|
+
code. No change to the wire format or the public API.
|
|
68
|
+
|
|
69
|
+
### Fixed
|
|
70
|
+
|
|
71
|
+
- A network failure during the library's own re-authentication (a timeout,
|
|
72
|
+
or the endpoint being closed) is raised as that failure. 1.0.3 to 1.0.5
|
|
73
|
+
returned the device's original expired-key answer instead, so the caller
|
|
74
|
+
raised `AuthorizationError` for what was really a timeout.
|
|
75
|
+
- An endpoint with no address on either side (discovery, `ping()`,
|
|
76
|
+
`setup()`) is bound to `0.0.0.0` explicitly, for the proactor loop on
|
|
77
|
+
Windows, which starts receiving as soon as the endpoint exists.
|
|
78
|
+
- The RM Max comment and the 1.0.0 changelog entry no longer claim more
|
|
79
|
+
than upstream #838 showed: the mapping follows that pull request's diff,
|
|
80
|
+
and its testers reported the device answering "locked" on
|
|
81
|
+
authentication, so it is listed as reported, not confirmed.
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
|
|
85
|
+
- An undecodable capture is logged at debug rather than warning, since the
|
|
86
|
+
window re-arms and carries on by itself.
|
|
87
|
+
- The RF capture loop closes its inner generator with `aclosing` like the
|
|
88
|
+
IR one.
|
|
89
|
+
|
|
90
|
+
## 1.0.5 - 2026-09-06
|
|
91
|
+
|
|
92
|
+
Fixes from a fifth review, of 1.0.4. No change to the wire format or the
|
|
93
|
+
public API.
|
|
94
|
+
|
|
95
|
+
### Fixed
|
|
96
|
+
|
|
97
|
+
- A connected socket can learn from ICMP that a host cannot be reached
|
|
98
|
+
(`EHOSTUNREACH`, typically a router answering for a device that is off),
|
|
99
|
+
and 1.0.4 raised that as an `OSError` at once. The original library's
|
|
100
|
+
unconnected socket never saw it and simply timed out, and Home
|
|
101
|
+
Assistant tolerates a timeout for a few polls where it marks a device
|
|
102
|
+
unavailable on the first `OSError`. Host unreachable, and Windows's
|
|
103
|
+
`ConnectionResetError` for port unreachable, are now treated as silence
|
|
104
|
+
like port unreachable already was: logged, the timeout decides, and the
|
|
105
|
+
socket is still dropped afterwards. Measured on the bench first: on the
|
|
106
|
+
test network neither an on-link address with no host behind it nor an
|
|
107
|
+
off-subnet one produced the ICMP, so this is insurance for networks
|
|
108
|
+
that do, not a fix for one that reproduced.
|
|
109
|
+
- `discover()` closes the `xdiscover()` generator it drains, like
|
|
110
|
+
`hello()` and `xdiscover()` itself.
|
|
111
|
+
|
|
112
|
+
### Changed
|
|
113
|
+
|
|
114
|
+
- The capture window claim is a flag set on the window's first iteration
|
|
115
|
+
and cleared when its generator finishes or is closed, including by
|
|
116
|
+
asyncio's finalizer, in place of the weak reference and frame
|
|
117
|
+
inspection used since 1.0.0. Same behaviour, pinned by the same tests:
|
|
118
|
+
a dropped window gets one turn to be finalized and then blocks nobody,
|
|
119
|
+
a held or paused window is refused to a newcomer. One visible
|
|
120
|
+
difference: `CaptureInProgressError` now always comes from the new
|
|
121
|
+
window's first iteration, never from the `capture()` call itself.
|
|
122
|
+
- A comment next to the RM Max entry says why it sits in `rmpro`
|
|
123
|
+
(upstream #838's text says rm4pro, its tested diff says rmpro).
|
|
124
|
+
- README: a device belongs to the event loop it first talks on.
|
|
125
|
+
|
|
126
|
+
## 1.0.4 - 2026-09-06
|
|
127
|
+
|
|
128
|
+
Fixes from a fourth review, of 1.0.3, which drove the real socket path the
|
|
129
|
+
test suite fakes and found two behaviours the original library had and
|
|
130
|
+
this one had lost. One device fix carried from upstream.
|
|
131
|
+
|
|
132
|
+
### Fixed
|
|
133
|
+
|
|
134
|
+
- A connected socket that went bad (interface bounce, host address change,
|
|
135
|
+
container network restart) was never replaced: the request waited out
|
|
136
|
+
its timeout and every later request did the same until `aclose()`. The
|
|
137
|
+
original opened a socket per call, so it healed on the next one. Now a
|
|
138
|
+
send failure the socket reports (no route, address gone) fails the
|
|
139
|
+
waiting request at once with that `OSError`, and a request that fails
|
|
140
|
+
for a network reason (that, or a timeout) drops the socket so the next
|
|
141
|
+
call opens a fresh one. A transport asyncio closes from its side also
|
|
142
|
+
wakes the waiting request instead of leaving it to time out. An ICMP
|
|
143
|
+
"port unreachable" (a host that is up with nothing listening, or a
|
|
144
|
+
device mid-reboot) is logged and treated as silence, since the
|
|
145
|
+
original's unconnected socket never saw those, so the timeout decides
|
|
146
|
+
as before.
|
|
147
|
+
- `discover()`, `hello()`, `ping()` and `setup()` passed hostnames straight
|
|
148
|
+
to `sendto`, which resolved them with a blocking call on the event loop
|
|
149
|
+
and swallowed the failure: a name that did not resolve made `hello()`
|
|
150
|
+
wait out its timeout and `ping()` return without sending. The
|
|
151
|
+
destination is now resolved once, off the loop, and `socket.gaierror`
|
|
152
|
+
propagates as it did from the original's socket. A send failure in
|
|
153
|
+
`ping()` and `setup()` is raised too.
|
|
154
|
+
- The A2 air quality sensor's request frame was two bytes short and
|
|
155
|
+
declared the wrong length, and real units answered every read with
|
|
156
|
+
error -5. The frame now follows the SP4/LB1 layout, which is byte for
|
|
157
|
+
byte the packet upstream pull request #826 tested on an A2. That is the
|
|
158
|
+
one oracle case re-recorded on purpose; the fix is carried on the
|
|
159
|
+
strength of that report, not of hardware we have.
|
|
160
|
+
- `xdiscover()` closes the `scan()` generator it wraps, so the discovery
|
|
161
|
+
socket is closed when the caller stops iterating rather than by the
|
|
162
|
+
finalizer a few turns later (1.0.2 claimed this and only `Device.hello()`
|
|
163
|
+
did it).
|
|
164
|
+
- Two identical captures compare equal: `CapturedSignal.captured_at` no
|
|
165
|
+
longer takes part in equality or hashing.
|
|
166
|
+
- Async generator functions are annotated `AsyncGenerator`, which has the
|
|
167
|
+
`aclose()` the library and the README call; `AsyncIterator` does not.
|
|
168
|
+
- The `TICK` docstring tells the same story as the README: 8192/269 from
|
|
169
|
+
protocol.md's measured conversion, not a 32768 Hz clock.
|
|
170
|
+
|
|
171
|
+
### Added
|
|
172
|
+
|
|
173
|
+
- A loopback test module that drives the real datagram endpoint, including
|
|
174
|
+
the socket-error path, since every other transport test fakes it.
|
|
175
|
+
- README: which errors `discover()` and `hello()` raise, that a failed
|
|
176
|
+
request drops its socket, and that `CaptureInProgressError` can come
|
|
177
|
+
from the `capture()` call or from the first iteration.
|
|
178
|
+
|
|
179
|
+
## 1.0.3 - 2026-09-06
|
|
180
|
+
|
|
181
|
+
Fixes from a third review, this one of 1.0.2. No change to the wire
|
|
182
|
+
format. One small API change: `pulses` on a captured signal is a tuple.
|
|
183
|
+
|
|
184
|
+
### Fixed
|
|
185
|
+
|
|
186
|
+
- When the device answered that the session key had expired and the
|
|
187
|
+
re-authentication then failed (for example because the device had been
|
|
188
|
+
locked in the app), the call raised `AuthenticationError` from the
|
|
189
|
+
re-authentication instead of the error the device gave the request. The
|
|
190
|
+
original library never re-authenticated, so a program written against
|
|
191
|
+
it, Home Assistant's integration included, handles the request's own
|
|
192
|
+
error and never expected the other one. The failed re-authentication is
|
|
193
|
+
now logged and the request's original reply is returned, so the caller
|
|
194
|
+
sees the same `AuthorizationError` or `ConnectionClosedError` it always
|
|
195
|
+
did.
|
|
196
|
+
- The authentication generation was read before the request lock was
|
|
197
|
+
taken rather than under it, so a request queued behind an `auth()`
|
|
198
|
+
could observe a stale generation and skip a re-authentication it needed.
|
|
199
|
+
- `aclose()` racing an endpoint that was still being opened could leave
|
|
200
|
+
the new socket open and unreferenced. The open now notices the close
|
|
201
|
+
and fails with `EndpointClosedError`.
|
|
202
|
+
- After a new capture window gives the finalizer its turn, it re-checks
|
|
203
|
+
that no other window claimed the device in the meantime.
|
|
204
|
+
- `CapturedSignal` and `ParsedPacket` are frozen dataclasses, but they
|
|
205
|
+
held a list, so they could not be hashed or put in a set. `pulses` is
|
|
206
|
+
now a `tuple[int, ...]`.
|
|
207
|
+
- `check_error` unpacks the error code as little-endian explicitly
|
|
208
|
+
(`"<h"`), matching the rest of the code, instead of native order.
|
|
209
|
+
- The CLI closes the device it opens instead of leaving that to
|
|
210
|
+
`asyncio.run`, which warned under `python -X dev`.
|
|
211
|
+
- The locks are created in `__init__` rather than lazily in two places.
|
|
212
|
+
|
|
213
|
+
### Changed
|
|
214
|
+
|
|
215
|
+
- `send_packet` accepts a `bytearray` payload as well as `bytes`.
|
|
216
|
+
- `setup()` sends its provisioning packet through a new
|
|
217
|
+
`send_setup_packet()` helper in `broadlink.device` instead of reaching
|
|
218
|
+
into a private function.
|
|
219
|
+
- README: the re-authentication contract and its worst case (one call can
|
|
220
|
+
wait out up to three timeouts), the A2 sensor and the Hysen HY02/HY03
|
|
221
|
+
in the device list, and the hello response's `mac` being `bytes` in the
|
|
222
|
+
list of differences from 0.19.0.
|
|
223
|
+
|
|
224
|
+
## 1.0.2 - 2026-09-05
|
|
225
|
+
|
|
226
|
+
Fixes from a second, adversarial review of 1.0.1 and a re-test of the
|
|
227
|
+
first review's findings. No change to the wire format or the public API.
|
|
228
|
+
|
|
229
|
+
### Fixed
|
|
230
|
+
|
|
231
|
+
- 1.0.1's reply matching dropped a late reply to a request that had
|
|
232
|
+
timed out, but not the second reply to a request that was resent after a
|
|
233
|
+
silent second and then answered twice. That duplicate carries the counter
|
|
234
|
+
of a request that succeeded, and it could still be taken as the answer
|
|
235
|
+
to the next request. The library now remembers every recently used
|
|
236
|
+
counter and drops any reply carrying one other than the current
|
|
237
|
+
request's. A reply whose counter the device has not used recently is
|
|
238
|
+
still accepted, for firmware that may not echo it.
|
|
239
|
+
- `auth()` reset the session id and key before taking the request lock, so
|
|
240
|
+
a request already queued behind the lock could be framed with device id
|
|
241
|
+
0 and the initial key. The reset, the exchange and the install of the
|
|
242
|
+
new key now happen as one unit under the lock.
|
|
243
|
+
- 1.0.1 let a new capture window close one that a consumer had abandoned,
|
|
244
|
+
using "is the generator running right now" as the test. That cannot
|
|
245
|
+
tell an abandoned window from one whose consumer is awaiting something
|
|
246
|
+
between signals, which the README's own example does. A new window now
|
|
247
|
+
gives asyncio's finalizer one turn to close a genuinely dropped
|
|
248
|
+
generator and then refuses if the old window is still alive, rather
|
|
249
|
+
than taking it. A refused attempt no longer displaces the live window.
|
|
250
|
+
- A packet the device returned that cannot be decoded (a declared length
|
|
251
|
+
running into a truncated escape) no longer ends the capture window; it
|
|
252
|
+
is logged and the window re-arms.
|
|
253
|
+
- `aclose()` during a request now raises `EndpointClosedError`, a subclass
|
|
254
|
+
of `ConnectionClosedError` with code -4013 in the error table, so a
|
|
255
|
+
caller that closed the device on purpose can tell that apart from the
|
|
256
|
+
device's own "logged out" answer.
|
|
257
|
+
- `hello()` closes the discovery generator it breaks out of instead of
|
|
258
|
+
leaving the socket to the finalizer; `asyncio.TimeoutError` is spelled
|
|
259
|
+
`TimeoutError`; an unused future on the protocol object is gone.
|
|
260
|
+
|
|
261
|
+
### Added
|
|
262
|
+
|
|
263
|
+
- Debug logging on the `broadlink.device` and `broadlink.remote` loggers:
|
|
264
|
+
endpoint open and close, resends, dropped late replies, timeouts,
|
|
265
|
+
re-authentication, capture arm and re-arm, captured packets.
|
|
266
|
+
- README: a "Closing" section on the persistent socket, a "Timing" section
|
|
267
|
+
with the bench measurement of the tick fix (5.4 percent short before,
|
|
268
|
+
0.6 percent short after, on an RM4 Pro against an independent
|
|
269
|
+
receiver), a note that Python 3.13 is a support decision, and the short
|
|
270
|
+
list of return-value differences from 0.19.0.
|
|
271
|
+
|
|
272
|
+
### Changed
|
|
273
|
+
|
|
274
|
+
- The code is formatted with `ruff format` and CI checks it.
|
|
275
|
+
|
|
276
|
+
## 1.0.1 - 2026-09-05
|
|
277
|
+
|
|
278
|
+
Fixes from an independent review of 1.0.0, most of them in the transport.
|
|
279
|
+
None changes the wire format or the public API.
|
|
280
|
+
|
|
281
|
+
### Fixed
|
|
282
|
+
|
|
283
|
+
- A reply to a request that had already timed out could be delivered as the
|
|
284
|
+
reply to the next request on the same device, because the persistent
|
|
285
|
+
endpoint (new in 1.0.0) is not thrown away between calls the way the old
|
|
286
|
+
per-call socket was. Replies are now matched to their request by the
|
|
287
|
+
packet counter the device echoes at offset 0x28; a reply carrying the
|
|
288
|
+
counter of a request that already timed out is discarded, and a reply
|
|
289
|
+
whose counter matches nothing the device sent is still accepted, so
|
|
290
|
+
firmware that does not echo the counter is unaffected. Confirmed on an
|
|
291
|
+
RM4 Pro, which echoes it.
|
|
292
|
+
- `capture()` treated only `StorageError` (-5) as "nothing captured yet".
|
|
293
|
+
Some firmware answers `ReadError` (-10); both are now treated as "nothing
|
|
294
|
+
yet", matching what the original CLI and Home Assistant do while polling.
|
|
295
|
+
The CLI's `--learn` and `--rflearn` inherit the fix.
|
|
296
|
+
- Abandoning a capture generator without closing it (for example `break`
|
|
297
|
+
out of `async for` to take one code) no longer blocks the next
|
|
298
|
+
`capture()` on the same device: opening a new window closes an abandoned
|
|
299
|
+
one. Opening a window while another is actively being iterated still
|
|
300
|
+
raises `CaptureInProgressError`. A new read-only `Device.capture_active`
|
|
301
|
+
property reports whether a window is open.
|
|
302
|
+
- Re-authentication is now shared between concurrent callers: when several
|
|
303
|
+
requests hit an expired session key at once, the library authenticates
|
|
304
|
+
once and every caller retries, instead of one caller re-authenticating
|
|
305
|
+
and the others surfacing the raw error. The logged-out code (-2) now
|
|
306
|
+
triggers re-authentication as well, matching Home Assistant's own retry.
|
|
307
|
+
- Changing `device.host` after the endpoint is open now reopens it against
|
|
308
|
+
the new address instead of continuing to talk to the old one.
|
|
309
|
+
- `aclose()` while a request is in flight fails that request at once with
|
|
310
|
+
`ConnectionClosedError` instead of waiting out the timeout.
|
|
311
|
+
|
|
312
|
+
### Documentation
|
|
313
|
+
|
|
314
|
+
- The README explains that `broadlink` and `python-broadlink` install the
|
|
315
|
+
same package name and cannot coexist, and how to recover if both were
|
|
316
|
+
installed.
|
|
317
|
+
- The changelog no longer describes the carried-over device commits as
|
|
318
|
+
"intact" (they were squash-merged with `Co-authored-by` credit) and no
|
|
319
|
+
longer overstates what the oracle records.
|
|
320
|
+
|
|
321
|
+
## 1.0.0 - 2026-09-05
|
|
322
|
+
|
|
323
|
+
This is the first release of `python-broadlink`, a maintained fork of
|
|
324
|
+
`mjg59/python-broadlink` (PyPI `broadlink`, last released as 0.19.0). The
|
|
325
|
+
history below starts at that fork point.
|
|
326
|
+
|
|
327
|
+
### Changed
|
|
328
|
+
|
|
329
|
+
- **The library is asynchronous.** Every method that talks to a device is
|
|
330
|
+
now a coroutine: `await device.auth()`, `await device.send_data(...)`,
|
|
331
|
+
`await device.check_sensors()`, and so on. Discovery is
|
|
332
|
+
`await broadlink.discover(...)`, `broadlink.hello(...)` and `setup(...)`
|
|
333
|
+
are coroutines, and `xdiscover(...)` is an async generator. The packet
|
|
334
|
+
helpers (`pulses_to_data`, `data_to_pulses`), CRC and datetime helpers
|
|
335
|
+
stay synchronous. There is no synchronous compatibility layer: a call
|
|
336
|
+
without `await` returns a coroutine and does nothing.
|
|
337
|
+
- Each device keeps one UDP endpoint for its lifetime (the previous
|
|
338
|
+
version opened a socket per call) and serializes requests on it with an
|
|
339
|
+
`asyncio.Lock`. The old code declared a lock but never acquired it.
|
|
340
|
+
`async with device:` or `await device.aclose()` releases the endpoint;
|
|
341
|
+
it reopens on the next call.
|
|
342
|
+
- When a device reports that the session key has expired, the library
|
|
343
|
+
re-authenticates once and repeats the request. Callers no longer need
|
|
344
|
+
their own re-auth loop.
|
|
345
|
+
- Retry and timeout behaviour is unchanged: a request is repeated every
|
|
346
|
+
second until `timeout` elapses, then `NetworkTimeoutError` is raised.
|
|
347
|
+
- `dooya.set_percentage_and_wait` sleeps with `asyncio.sleep`.
|
|
348
|
+
- The CLI tools run their body under `asyncio.run`. `broadlink_cli
|
|
349
|
+
--learn` and `--rflearn` use `capture()` / `capture_rf()`, so a learning
|
|
350
|
+
session no longer goes deaf when the device times out partway through;
|
|
351
|
+
`--window` sets how long to listen, `--keep` prints every code heard, and
|
|
352
|
+
`--send --durations --repeat N` sets the repeat count. The CLI README's
|
|
353
|
+
`--rfscanlearn` was a typo for `--rflearn` (mjg59/python-broadlink#803,
|
|
354
|
+
#830).
|
|
355
|
+
- `pulses_to_data` returns `bytes` (it returned a `bytearray`, against its
|
|
356
|
+
own annotation).
|
|
357
|
+
- The device's request lock is now a private `_lock` that is actually
|
|
358
|
+
acquired; the unused public `Device.lock` attribute is gone.
|
|
359
|
+
- Packaging moved to `pyproject.toml`; `setup.py` and the stale
|
|
360
|
+
`requirements.txt` pin are gone. The distribution name is now
|
|
361
|
+
`python-broadlink`; the import name stays `broadlink`. Python 3.13 or
|
|
362
|
+
newer is required.
|
|
363
|
+
- Continuous integration now runs `ruff` and `pytest` on Python 3.13 and
|
|
364
|
+
3.14, and builds the sdist and wheel on every pull request. Releases are
|
|
365
|
+
published to PyPI from version tags using trusted publishing.
|
|
366
|
+
|
|
367
|
+
### Fixed
|
|
368
|
+
|
|
369
|
+
- The IR tick constant used by `pulses_to_data` and `data_to_pulses` is now
|
|
370
|
+
`TICK = 8192 / 269` (about 30.45 us), matching the device's 32768 Hz
|
|
371
|
+
timebase as documented in `protocol.md`. The previous value, 32.84, was
|
|
372
|
+
the inverse ratio applied the wrong way round and compressed IR codes
|
|
373
|
+
built from true microsecond timings by about 7 percent. Codes learned and
|
|
374
|
+
replayed through the same device were unaffected. Verified on an RM4 Pro
|
|
375
|
+
against an independent receiver in both directions.
|
|
376
|
+
(mjg59/python-broadlink#839, #841)
|
|
377
|
+
- `pulses_to_data` rounds each duration to the nearest tick instead of
|
|
378
|
+
truncating, which removes up to one tick of systematic shortening per
|
|
379
|
+
pulse.
|
|
380
|
+
|
|
381
|
+
### Added
|
|
382
|
+
|
|
383
|
+
- `capture()` and `capture_rf()`, async generators that own the arm, poll,
|
|
384
|
+
timeout and re-arm loop of a learning session and yield each signal as a
|
|
385
|
+
`CapturedSignal` (device packet, decoded pulses at the correct tick,
|
|
386
|
+
kind, repeat count, and for RF the carrier frequency). They re-arm on a
|
|
387
|
+
timer, because the device leaves learning mode silently, and after any
|
|
388
|
+
`send_data`, because a transmission ends the session; both intervals and
|
|
389
|
+
the poll cadence were set from a bench on an RM4 Pro. Only one window can
|
|
390
|
+
be open per device. `capture_rf()` (Pro models only) takes the carrier
|
|
391
|
+
frequency directly and falls back to the on-device sweep when it is not
|
|
392
|
+
given.
|
|
393
|
+
- Packet helpers: `pulses_to_data` takes `kind` and `repeat`, `parse_packet`
|
|
394
|
+
is its inverse, and `SignalKind` names the IR, 433 MHz and 315 MHz bands.
|
|
395
|
+
A device's returned RF packet does not always use the canonical type byte
|
|
396
|
+
(an RM4 Pro answers a 433 MHz capture with 0xB1, not 0xB2), so the kind is
|
|
397
|
+
read by band and a capture is tagged from what it armed rather than the
|
|
398
|
+
byte.
|
|
399
|
+
- Devices, carried over from pull requests against the original repository
|
|
400
|
+
with their authors credited (the changes were squash-merged with
|
|
401
|
+
`Co-authored-by` trailers naming each author): RM5 plus 0x5224 with a new `rm5plus` class (#831, Anil Daoud); RM mini 3
|
|
402
|
+
OEM 0xA544 (#823, Bartłomiej Nogaś); RM mini 3 CMCC 0x27C8 (#802,
|
|
403
|
+
shuxin); LB26 R1 0xA517 (#812, techitapart); SP mini 3-AL 0x7D15 (#805,
|
|
404
|
+
bbcbbk); LEDVANCE SMART+ WIFI CEILING TW 24W 0x6498 (#799, Felipe Martins
|
|
405
|
+
Diel).
|
|
406
|
+
- Devices reported in issues against the original repository, added by
|
|
407
|
+
model name to the existing class for that family and not yet confirmed on
|
|
408
|
+
hardware: MP1-1K3S2U 0x4EDA (#816) and SP4 0xA57A (#758), and the RM Max
|
|
409
|
+
0xAF8B from #838 (Alexey Masolov, credited), whose testers reported the
|
|
410
|
+
device answering "locked" on authentication. Please open an issue if any
|
|
411
|
+
of them does not behave.
|
|
412
|
+
- `cryptography` 43 or newer is required, the first release with wheels for
|
|
413
|
+
Python 3.13 (supersedes mjg59/python-broadlink#749).
|
|
414
|
+
- A test suite. The `tests/oracle` package records, for every public method
|
|
415
|
+
of every device class, the request each one hands to the transport (its
|
|
416
|
+
packet type and plaintext payload) and the result it decodes from a canned
|
|
417
|
+
response, so that a later reimplementation can be checked against the
|
|
418
|
+
original method by method; the framing, encryption and checksum layer is
|
|
419
|
+
covered separately by `tests/test_transport.py`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014 Mike Ryan
|
|
4
|
+
Copyright (c) 2016 Matthew Garrett
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in
|
|
14
|
+
all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
22
|
+
THE SOFTWARE.
|