From 367fed5f64548777c482b2fca2a9474f47650418 Mon Sep 17 00:00:00 2001 From: Denis Shulyaka Date: Sun, 5 Nov 2023 19:21:07 +0300 Subject: [PATCH] Fix energy scan duraton (#168) --- tests/test_application.py | 2 +- zigpy_xbee/zigbee/application.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_application.py b/tests/test_application.py index 03ce25c..a508caf 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -709,7 +709,7 @@ async def test_energy_scan(app): energy = await app.energy_scan( channels=list(range(11, 27)), duration_exp=time_s, count=count ) - assert app._api._at_command.mock_calls == [mock.call("ED", time_s)] * count + assert app._api._at_command.mock_calls == [mock.call("ED", bytes([time_s]))] * count assert {k: round(v, 3) for k, v in energy.items()} == { 11: 254.032, 12: 253.153, diff --git a/zigpy_xbee/zigbee/application.py b/zigpy_xbee/zigbee/application.py index d5c0d65..5733fc9 100644 --- a/zigpy_xbee/zigbee/application.py +++ b/zigpy_xbee/zigbee/application.py @@ -196,7 +196,7 @@ async def energy_scan( all_results = {} for _ in range(count): - results = await self._api._at_command("ED", duration_exp) + results = await self._api._at_command("ED", bytes([duration_exp])) results = { channel: -int(rssi) for channel, rssi in zip(range(11, 27), results) }