Skip to content

Commit 606dfc9

Browse files
authored
Merge pull request #142 from puddly/rc
0.10.3 Release
2 parents 84eda3e + 57db494 commit 606dfc9

File tree

3 files changed

+26
-3
lines changed

3 files changed

+26
-3
lines changed

tests/test_application.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,24 @@ async def test_startup_connect(zigate_new, app, version_rsp, expected_version):
152152
assert app.version == expected_version
153153

154154

155+
@pytest.mark.asyncio
156+
@pytest.mark.parametrize("version, addr_mode", [
157+
["3.1z", t.AddressMode.NWK_NO_ACK],
158+
["3.1d", t.AddressMode.NWK],
159+
])
160+
async def test_send_unicast_request(app, version, addr_mode):
161+
packet = zigpy_t.ZigbeePacket(src=zigpy_t.AddrModeAddress(addr_mode=zigpy_t.AddrMode.NWK, address=0x0000), src_ep=1, dst=zigpy_t.AddrModeAddress(addr_mode=zigpy_t.AddrMode.NWK, address=0xFA5D), dst_ep=1, source_route=None, extended_timeout=False, tsn=20, profile_id=260, cluster_id=6, data=zigpy_t.SerializableBytes(b'\x01\x14\x00'), tx_options=zigpy_t.TransmitOptions.NONE, radius=0, non_member_radius=0, lqi=None, rssi=None)
162+
163+
app.version = version
164+
app._api.raw_aps_data_request.return_value = ([t.Status.Success, 163, 1328, b'\x00\x00'], 0)
165+
await app.send_packet(packet)
166+
167+
# The packet was sent with ACKs, even though zigpy didn't ask for it
168+
assert app._api.raw_aps_data_request.mock_calls[0].kwargs["addr_mode"] == addr_mode
169+
170+
app._api.raw_aps_data_request.assert_called_once()
171+
172+
155173
@pytest.mark.asyncio
156174
async def test_send_group_request(app):
157175
packet = zigpy_t.ZigbeePacket(src=None, src_ep=1, dst=zigpy_t.AddrModeAddress(addr_mode=zigpy_t.AddrMode.Group, address=0x0002), dst_ep=None, source_route=None, extended_timeout=False, tsn=21, profile_id=260, cluster_id=6, data=zigpy_t.SerializableBytes(b'\x01\x15\x00'), tx_options=zigpy_t.TransmitOptions.NONE, radius=0, non_member_radius=3, lqi=None, rssi=None)

zigpy_zigate/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
MAJOR_VERSION = 0
22
MINOR_VERSION = 10
3-
PATCH_VERSION = '2'
3+
PATCH_VERSION = '3'
44
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
55
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)

zigpy_zigate/zigbee/application.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,12 @@ def _handle_frame_failure(self, message_tag, status):
238238
async def send_packet(self, packet):
239239
LOGGER.debug("Sending packet %r", packet)
240240

241-
ack = (zigpy.types.TransmitOptions.ACK in packet.tx_options)
241+
# Firmwares 3.1d and below allow a couple of _NO_ACK packets to send but all
242+
# subsequent ones will fail. ACKs must be enabled.
243+
ack = (
244+
zigpy.types.TransmitOptions.ACK in packet.tx_options
245+
or self.version <= "3.1d"
246+
)
242247

243248
try:
244249
(status, tsn, packet_type, _), _ = await self._api.raw_aps_data_request(
@@ -263,7 +268,7 @@ async def send_packet(self, packet):
263268
if status == t.Status.InvalidParameter and self.version <= "3.1d":
264269
pass
265270
else:
266-
raise zigpy.exceptions.DeliveryError(f"Failed to send packet: {status}", status=status)
271+
raise zigpy.exceptions.DeliveryError(f"Failed to send packet: {status!r}", status=status)
267272

268273
# disabled because of https://github.com/fairecasoimeme/ZiGate/issues/324
269274
# try:

0 commit comments

Comments
 (0)