From c241270766e011b9cba7bcbebe75aef8ffb514fc Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Mon, 30 Dec 2024 10:49:11 +0100 Subject: [PATCH 1/3] warning instead of debug --- pylamarzocco/clients/local.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylamarzocco/clients/local.py b/pylamarzocco/clients/local.py index d04a361..0469619 100644 --- a/pylamarzocco/clients/local.py +++ b/pylamarzocco/clients/local.py @@ -118,7 +118,7 @@ async def websocket_connect( ) as ws: self.websocket = ws if self.websocket_disconnected: - _LOGGER.debug("Websocket reconnected") + _LOGGER.warning("Websocket reconnected") self.websocket_disconnected = False async for msg in ws: if msg.type in (WSMsgType.CLOSING, WSMsgType.CLOSED): From 6aab2aad568bb8539ee3c4f5f373d7b6160468bc Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Mon, 30 Dec 2024 10:51:19 +0100 Subject: [PATCH 2/3] bump version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 40ed047..46b7ad4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "pylamarzocco" -version = "1.4.4" +version = "1.4.5" license = { text = "MIT" } description = "A Python implementation of the new La Marzocco API" readme = "README.md" From 07f6f1396201ed29e1329bf3df71973744dc79f8 Mon Sep 17 00:00:00 2001 From: Josef Zweck <24647999+zweckj@users.noreply.github.com> Date: Mon, 30 Dec 2024 10:54:08 +0100 Subject: [PATCH 3/3] write without response --- pylamarzocco/clients/bluetooth.py | 9 ++++++++- tests/test_bluetooth.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pylamarzocco/clients/bluetooth.py b/pylamarzocco/clients/bluetooth.py index 52e070c..1a018d4 100644 --- a/pylamarzocco/clients/bluetooth.py +++ b/pylamarzocco/clients/bluetooth.py @@ -2,6 +2,7 @@ from __future__ import annotations +import asyncio import base64 import json import logging @@ -134,6 +135,7 @@ async def authenticate() -> None: await client.write_gatt_char( char_specifier=AUTH_CHARACTERISTIC, data=auth_string, + response=False, ) except (BleakError, TimeoutError) as e: raise BluetoothConnectionFailed( @@ -141,11 +143,16 @@ async def authenticate() -> None: ) from e await authenticate() + await asyncio.sleep(0.1) _logger.debug( "Sending bluetooth message: %s to %s", message, characteristic ) - await client.write_gatt_char(char_specifier=characteristic, data=message) + await client.write_gatt_char( + char_specifier=characteristic, + data=message, + response=False, + ) async def _write_bluetooth_json_message( self, diff --git a/tests/test_bluetooth.py b/tests/test_bluetooth.py index 27c390f..1a53fe0 100644 --- a/tests/test_bluetooth.py +++ b/tests/test_bluetooth.py @@ -21,11 +21,13 @@ async def test_bluetooth_set_power( mock_bleak.write_gatt_char.assert_any_call( # type: ignore[attr-defined] char_specifier=AUTH_CHARACTERISTIC, data=b"dXNlcm5hbWU6c2VyaWFs@dG9rZW4=", + response=False, ) mock_bleak.write_gatt_char.assert_called_with( # type: ignore[attr-defined] char_specifier=SETTINGS_CHARACTERISTIC, data=b'{"name":"MachineChangeMode","parameter":{"mode":"BrewingMode"}}\x00', + response=False, ) @@ -39,11 +41,13 @@ async def test_bluetooth_set_steam( mock_bleak.write_gatt_char.assert_any_call( # type: ignore[attr-defined] char_specifier=AUTH_CHARACTERISTIC, data=b"dXNlcm5hbWU6c2VyaWFs@dG9rZW4=", + response=False, ) mock_bleak.write_gatt_char.assert_called_with( # type: ignore[attr-defined] char_specifier=SETTINGS_CHARACTERISTIC, data=b'{"name":"SettingBoilerEnable","parameter":{"identifier":"SteamBoiler","state":true}}\x00', + response=False, ) @@ -57,9 +61,11 @@ async def test_bluetooth_set_temperature( mock_bleak.write_gatt_char.assert_any_call( # type: ignore[attr-defined] char_specifier=AUTH_CHARACTERISTIC, data=b"dXNlcm5hbWU6c2VyaWFs@dG9rZW4=", + response=False, ) mock_bleak.write_gatt_char.assert_called_with( # type: ignore[attr-defined] char_specifier=SETTINGS_CHARACTERISTIC, data=b'{"name":"SettingBoilerTarget","parameter":{"identifier":"SteamBoiler","value":131}}\x00', + response=False, )