From 1b764c013a920b8382bb1dd1d8e3482d48050ee6 Mon Sep 17 00:00:00 2001 From: builder555 <85308587+builder555@users.noreply.github.com> Date: Thu, 25 Jan 2024 17:30:35 -0500 Subject: [PATCH 1/4] fix: start scrtipt on mac clears protection attribute --- ci/start.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/start.sh b/ci/start.sh index 2878a094..3f9846ad 100755 --- a/ci/start.sh +++ b/ci/start.sh @@ -13,7 +13,7 @@ if [ "$(uname)" == "Darwin" ]; then # this is needed because the mac will not execute binaries that are downloaded from the internet # see https://developer.apple.com/library/archive/technotes/tn2459/_index.html if xattr -p com.apple.quarantine ./Pinecil >/dev/null 2>&1; then - find ./ --name Pinecil | xargs xattr -rd com.apple.quarantine + find ./ -name Pinecil | xargs xattr -rd com.apple.quarantine fi fi From 5bd15d5ae94b014dd948732b5c56001efeca63e9 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 25 Jan 2024 22:31:36 +0000 Subject: [PATCH 2/4] chore: bump version to 2.1.13 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index 348fc11e..ea4bd0fb 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.1.12 +2.1.13 From b8d0a7619abb2544c3a3337f2f18d6a8331954d1 Mon Sep 17 00:00:00 2001 From: builder555 <85308587+builder555@users.noreply.github.com> Date: Thu, 25 Jan 2024 18:03:46 -0500 Subject: [PATCH 3/4] fix: catch any random BLE errors on LIVE_DATA --- backend/pinecil_monitor.py | 4 +++- backend/test_pinecil_monitor.py | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/backend/pinecil_monitor.py b/backend/pinecil_monitor.py index 3eea34c0..a3fc12cc 100644 --- a/backend/pinecil_monitor.py +++ b/backend/pinecil_monitor.py @@ -68,6 +68,8 @@ async def monitor(self, stop_event): await self.broadcast(msg) except DeviceDisconnectedException: logging.info("Pinecil disconnected") - self.broadcast( + await self.broadcast( json.dumps({"status": "ERROR", "message": "Device disconnected"}) ) + except Exception as e: + logging.warning("Error while getting live data - ignored") diff --git a/backend/test_pinecil_monitor.py b/backend/test_pinecil_monitor.py index 2b0bfa46..0ecbbb3b 100644 --- a/backend/test_pinecil_monitor.py +++ b/backend/test_pinecil_monitor.py @@ -77,7 +77,7 @@ def select_pinecil(index): @pytest.fixture def mock_broadcast(): - return MagicMock() + return AsyncMock() @pytest.mark.asyncio @@ -97,11 +97,12 @@ async def test_monitor_no_pinecil_found( @pytest.mark.asyncio async def test_monitor_success(mock_pinecil_finder, mock_broadcast): stop_event = asyncio.Event() - monitor = PinecilMonitor(mock_pinecil_finder, mock_broadcast) + mock_broadcast_sets_event = AsyncMock(side_effect=lambda msg: stop_event.set()) + + monitor = PinecilMonitor(mock_pinecil_finder, mock_broadcast_sets_event) asyncio.create_task(monitor.monitor(stop_event)) await asyncio.sleep(0.2) - stop_event.set() - mock_broadcast.assert_called_with( + mock_broadcast_sets_event.assert_called_with( '{"command": "LIVE_DATA", "payload": {"temp": 100, "voltage": 230}, "status": "OK"}' ) From 9a33fd56bd21fe96f4e5da084d5b9593abd2203b Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 25 Jan 2024 23:04:11 +0000 Subject: [PATCH 4/4] chore: bump version to 2.1.14 --- version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.txt b/version.txt index ea4bd0fb..1b5105df 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -2.1.13 +2.1.14