diff --git a/tests/test_application.py b/tests/test_application.py index 6b8934b..7c5a6db 100644 --- a/tests/test_application.py +++ b/tests/test_application.py @@ -224,3 +224,10 @@ def test_handle_reply_unexpected(app): assert app.handle_message.call_args[0][6] == tsn assert app.handle_message.call_args[0][7] == mock.sentinel.command_id assert app.handle_message.call_args[0][8] == mock.sentinel.args + + +@pytest.mark.asyncio +async def test_shutdown(app): + app._api.close = mock.MagicMock() + await app.shutdown() + assert app._api.close.call_count == 1 diff --git a/zigpy_deconz/zigbee/application.py b/zigpy_deconz/zigbee/application.py index f421631..4453e41 100644 --- a/zigpy_deconz/zigbee/application.py +++ b/zigpy_deconz/zigbee/application.py @@ -35,6 +35,10 @@ async def _reset_watchdog(self): await self._api.write_parameter(NETWORK_PARAMETER['watchdog_ttl'][0], 3600) await asyncio.sleep(1200) + async def shutdown(self): + """Shutdown application.""" + self._api.close() + async def startup(self, auto_form=False): """Perform a complete application startup""" r = await self._api.version()