From fd41a565a65faa3751580db7be156347afdb77cb Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:46:29 -0500 Subject: [PATCH 1/3] Update graphql.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ajout d'un contexte à la connexion SSL en dehors du event_loop --- pyhilo/graphql.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyhilo/graphql.py b/pyhilo/graphql.py index 8959345..39cceec 100644 --- a/pyhilo/graphql.py +++ b/pyhilo/graphql.py @@ -1,5 +1,6 @@ import asyncio import logging +import ssl from typing import Any, Dict, List, Optional from gql import Client, gql @@ -552,11 +553,17 @@ async def subscribe_to_device_updated( # Setting log level to suppress keepalive messages on gql transport logging.getLogger("gql.transport.websockets").setLevel(logging.WARNING) + + # + loop = asyncio.get_event_loop() + ssl_context = await loop.run_in_executor(None, ssl.create_default_context) + while True: # Loop to reconnect if the connection is lost LOG.debug("subscribe_to_device_updated while true") access_token = await self._get_access_token() transport = WebsocketsTransport( - url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}" + url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}", + ssl=ssl_context ) client = Client(transport=transport, fetch_schema_from_transport=True) query = gql(self.SUBSCRIPTION_DEVICE_UPDATED) From 95a319b82436cce9ee928a2f681a45384fbf2bcd Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:56:04 -0500 Subject: [PATCH 2/3] Linting --- pyhilo/graphql.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyhilo/graphql.py b/pyhilo/graphql.py index 39cceec..8c52ebb 100644 --- a/pyhilo/graphql.py +++ b/pyhilo/graphql.py @@ -563,7 +563,7 @@ async def subscribe_to_device_updated( access_token = await self._get_access_token() transport = WebsocketsTransport( url=f"wss://platform.hiloenergie.com/api/digital-twin/v3/graphql?access_token={access_token}", - ssl=ssl_context + ssl=ssl_context, ) client = Client(transport=transport, fetch_schema_from_transport=True) query = gql(self.SUBSCRIPTION_DEVICE_UPDATED) From 1d096776c55b3601620c0a6bbc5ac2c67cb800c8 Mon Sep 17 00:00:00 2001 From: "Ian C." <108159253+ic-dev21@users.noreply.github.com> Date: Sat, 8 Nov 2025 12:57:12 -0500 Subject: [PATCH 3/3] Bump up versions --- 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 814c645..613c257 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.10.02" +PYHILO_VERSION: Final = "2025.11.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 ea1ac45..3851e04 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,7 +40,7 @@ exclude = ".venv/.*" [tool.poetry] name = "python-hilo" -version = "2025.10.2" +version = "2025.11.1" description = "A Python3, async interface to the Hilo API" readme = "README.md" authors = ["David Vallee Delisle "]