From f796c8340a466f574f6d5d9612efba72707876d6 Mon Sep 17 00:00:00 2001 From: Jesse Sopel Date: Wed, 25 Oct 2023 20:17:01 -0400 Subject: [PATCH] fix: Use debug level for disconnect callback as it happens often when battery is low --- CHANGELOG.md | 4 ++++ ember_mug/mug.py | 2 +- tests/test_connection.py | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 656411c..995c445 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [0.8.1] +### Changed + +* Use debug level for disconnect callback instead of warning + ### Fixed * Don't require adapter keyword for other backends diff --git a/ember_mug/mug.py b/ember_mug/mug.py index 7802814..8fea0ed 100644 --- a/ember_mug/mug.py +++ b/ember_mug/mug.py @@ -168,7 +168,7 @@ def _disconnect_callback(self, client: BleakClient) -> None: if self._expected_disconnect: logger.debug("Disconnect callback called") else: - logger.warning("Unexpectedly disconnected") + logger.debug("Unexpectedly disconnected") def _fire_callbacks(self) -> None: """Fire the callbacks.""" diff --git a/tests/test_connection.py b/tests/test_connection.py index 9377589..120a64b 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -143,7 +143,7 @@ def test_disconnect_callback(mock_logger: Mock, ember_mug: AsyncMock) -> None: ember_mug._expected_disconnect = False ember_mug._disconnect_callback(AsyncMock()) - mock_logger.warning.assert_called_with("Unexpectedly disconnected") + mock_logger.debug.assert_called_with("Unexpectedly disconnected") @patch("ember_mug.mug.logger")