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/pyhilo/graphql.py b/pyhilo/graphql.py index 8959345..8c52ebb 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) 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 "]