From 091e9e0b8ef6d1574b5b86cdd4a7217dc846f1c0 Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Thu, 15 May 2025 13:13:34 -0400 Subject: [PATCH 1/4] Missing await --- pyhilo/graphql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhilo/graphql.py b/pyhilo/graphql.py index 1c913a1..b0acd8a 100644 --- a/pyhilo/graphql.py +++ b/pyhilo/graphql.py @@ -564,7 +564,7 @@ async def subscribe_to_device_updated( except Exception as e: print(f"Connection lost: {e}. Reconnecting in 5 seconds...") await asyncio.sleep(5) - self.call_get_location_query(location_hilo_id) + await self.call_get_location_query(location_hilo_id) async def subscribe_to_location_updated( self, location_hilo_id: str, callback: callable = None From ab62c18c42be4eea50651e1ab90bb3c00a6ea490 Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Thu, 15 May 2025 13:15:25 -0400 Subject: [PATCH 2/4] Typo for linting --- pyhilo/util/state.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhilo/util/state.py b/pyhilo/util/state.py index 08fe3f1..11d8e3c 100644 --- a/pyhilo/util/state.py +++ b/pyhilo/util/state.py @@ -161,7 +161,7 @@ async def set_state( LOG.debug("Saving state to yaml file") # TODO: Use asyncio.get_running_loop() and run_in_executor to write # to the file in a non blocking manner. Currently, the file writes - # are properly async but the yaml dump is done synchroniously on the + # are properly async but the yaml dump is done synchronously on the # main event loop. content = yaml.dump(new_state) await yaml_file.write(content) From 56fc12000aa8d81a4aa25a984be99a857b38afdb Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Thu, 15 May 2025 13:18:08 -0400 Subject: [PATCH 3/4] Bump up version --- pyhilo/const.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyhilo/const.py b/pyhilo/const.py index 334d6b6..d5dd388 100755 --- a/pyhilo/const.py +++ b/pyhilo/const.py @@ -7,7 +7,7 @@ LOG: Final = logging.getLogger(__package__) DEFAULT_STATE_FILE: Final = "hilo_state.yaml" REQUEST_RETRY: Final = 9 -PYHILO_VERSION: Final = "2025.4.02" +PYHILO_VERSION: Final = "2025.5.01" # TODO: Find a way to keep previous line in sync with pyproject.toml automatically CONTENT_TYPE_FORM: Final = "application/x-www-form-urlencoded" diff --git a/pyproject.toml b/pyproject.toml index f5278e8..8f25d9d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ exclude = ".venv/.*" [tool.poetry] name = "python-hilo" -version = "2025.4.2" +version = "2025.5.1" description = "A Python3, async interface to the Hilo API" readme = "README.md" authors = ["David Vallee Delisle "] From 6a4d07929054cc9e06fed5bf782119896a73cd37 Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Mon, 19 May 2025 21:32:35 -0400 Subject: [PATCH 4/4] Change print statements to debug logging --- pyhilo/graphql.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyhilo/graphql.py b/pyhilo/graphql.py index b0acd8a..f29ac6b 100644 --- a/pyhilo/graphql.py +++ b/pyhilo/graphql.py @@ -6,6 +6,7 @@ from gql.transport.websockets import WebsocketsTransport from pyhilo import API +from pyhilo.const import LOG from pyhilo.device.graphql_value_mapper import GraphqlValueMapper from pyhilo.devices import Devices @@ -557,12 +558,12 @@ async def subscribe_to_device_updated( async for result in session.subscribe( query, variable_values={"locationHiloId": location_hilo_id} ): - print(f"Received subscription result {result}") + LOG.debug(f"Received subscription result {result}") device_hilo_id = self._handle_device_subscription_result(result) if callback: callback(device_hilo_id) except Exception as e: - print(f"Connection lost: {e}. Reconnecting in 5 seconds...") + LOG.debug(f"Connection lost: {e}. Reconnecting in 5 seconds...") await asyncio.sleep(5) await self.call_get_location_query(location_hilo_id) @@ -580,11 +581,11 @@ async def subscribe_to_location_updated( async for result in session.subscribe( query, variable_values={"locationHiloId": location_hilo_id} ): - print(f"Received subscription result {result}") + LOG.debug(f"Received subscription result {result}") device_hilo_id = self._handle_location_subscription_result(result) callback(device_hilo_id) except asyncio.CancelledError: - print("Subscription cancelled.") + LOG.debug("Subscription cancelled.") asyncio.sleep(1) await self.subscribe_to_location_updated(location_hilo_id) @@ -602,7 +603,7 @@ def _handle_device_subscription_result(self, result: Dict[str, Any]) -> str: attributes = self.mapper.map_device_subscription_values(devices_values) updated_device = self._devices.parse_values_received(attributes) # callback to update the device in the UI - print(f"Device updated: {updated_device}") + LOG.debug(f"Device updated: {updated_device}") return devices_values.get("hiloId") def _handle_location_subscription_result(self, result: Dict[str, Any]) -> str: @@ -610,5 +611,5 @@ def _handle_location_subscription_result(self, result: Dict[str, Any]) -> str: attributes = self.mapper.map_location_subscription_values(devices_values) updated_device = self._devices.parse_values_received(attributes) # callback to update the device in the UI - print(f"Device updated: {updated_device}") + LOG.debug(f"Device updated: {updated_device}") return devices_values.get("hiloId")