Skip to content

Commit

Permalink
0.9.1 Release.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adminiuga authored Aug 20, 2019
2 parents 21af65c + 7dbc6fd commit 4267eec
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bellows/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
MAJOR_VERSION = 0
MINOR_VERSION = 9
PATCH_VERSION = '0'
PATCH_VERSION = '1'
__short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION)
__version__ = '{}.{}'.format(__short_version__, PATCH_VERSION)
13 changes: 8 additions & 5 deletions bellows/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,14 @@ async def request(self, nwk, profile, cluster, src_ep, dst_ep, sequence, data, e
aps_frame.groupId = t.uint16_t(0)
aps_frame.sequence = t.uint8_t(sequence)

dev = self.get_device(nwk=nwk)
if dev.node_desc.is_end_device in (True, None):
LOGGER.debug("Extending timeout for %s/0x%04x", dev.ieee, nwk)
await self._ezsp.setExtendedTimeout(dev.ieee, True)
timeout = APS_REPLY_TIMEOUT_EXTENDED
try:
dev = self.get_device(nwk=nwk)
if expect_reply and dev.node_desc.is_end_device in (True, None):
LOGGER.debug("Extending timeout for %s/0x%04x", dev.ieee, nwk)
await self._ezsp.setExtendedTimeout(dev.ieee, True)
timeout = APS_REPLY_TIMEOUT_EXTENDED
except KeyError:
pass
with self._pending.new(sequence, expect_reply) as req:
async with self._in_flight_msg:
res = await self._ezsp.sendUnicast(self.direct, nwk, aps_frame,
Expand Down
8 changes: 8 additions & 0 deletions tests/test_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ def test_permit_with_key_failed_set_policy(app, ieee):

def _request(app, returnvals, do_reply=True, send_ack_received=True,
send_ack_success=True, ezsp_operational=True, is_an_end_dev=None,
device_not_found=False,
**kwargs):
async def mocksend(method, nwk, aps_frame, seq, data):
if not ezsp_operational:
Expand All @@ -343,6 +344,8 @@ async def mocksend(method, nwk, aps_frame, seq, data):
return [returnvals.pop(0)]

def mock_get_device(*args, **kwargs):
if device_not_found:
raise KeyError
dev = Device(app, mock.sentinel.ieee, 0xaa55)
dev.node_desc = mock.MagicMock()
dev.node_desc.is_end_device = is_an_end_dev
Expand Down Expand Up @@ -442,6 +445,11 @@ def test_request_extended_timeout(app):
assert _request(app, [0], is_an_end_dev=None) == mock.sentinel.result
assert app._ezsp.setExtendedTimeout.call_count == 2

assert _request(app, [0],
is_an_end_dev=True,
device_not_found=True) == mock.sentinel.result
assert app._ezsp.setExtendedTimeout.call_count == 2


@pytest.mark.asyncio
async def _test_broadcast(app, broadcast_success=True, send_timeout=False,
Expand Down

0 comments on commit 4267eec

Please sign in to comment.