diff --git a/tests/test_application.py b/tests/test_application.py index 47c8891..d70373d 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -734,7 +734,7 @@ async def test_energy_scan(app): async def test_energy_scan_legacy_module(app): """Test channel energy scan.""" app._api._at_command = mock.AsyncMock( - spec=XBee._at_command, side_effect=RuntimeError + spec=XBee._at_command, side_effect=InvalidCommand ) time_s = 3 count = 3 diff --git a/zigpy_xbee/zigbee/application.py b/zigpy_xbee/zigbee/application.py index 058b6a5..dad1ae0 100644 --- a/zigpy_xbee/zigbee/application.py +++ b/zigpy_xbee/zigbee/application.py @@ -199,7 +199,7 @@ async def energy_scan( for _ in range(count): try: results = await self._api._at_command("ED", bytes([duration_exp])) - except RuntimeError: + except InvalidCommand: LOGGER.warning("Coordinator does not support energy scanning") return {c: 0 for c in channels}