Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyhilo/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
API_NOTIFICATIONS_ENDPOINT: Final = "/Notifications"
API_EVENTS_ENDPOINT: Final = "/Notifications"
API_REGISTRATION_ENDPOINT: Final = f"{API_NOTIFICATIONS_ENDPOINT}/Registrations"
PLATFORM_HOST: Final = "platform.hiloenergie.com"

API_REGISTRATION_HEADERS: Final = {
"AppId": ANDROID_PKG_NAME,
Expand Down
8 changes: 4 additions & 4 deletions pyhilo/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from gql.transport.websockets import WebsocketsTransport

from pyhilo import API
from pyhilo.const import LOG
from pyhilo.const import LOG, PLATFORM_HOST
from pyhilo.device.graphql_value_mapper import GraphqlValueMapper
from pyhilo.devices import Devices

Expand Down Expand Up @@ -534,7 +534,7 @@ async def call_get_location_query(self, location_hilo_id: str) -> None:
"""This functions calls the digital-twin and requests location id"""
access_token = await self._get_access_token()
transport = AIOHTTPTransport(
url="https://platform.hiloenergie.com/api/digital-twin/v3/graphql",
url=f"https://{PLATFORM_HOST}/api/digital-twin/v3/graphql",
headers={"Authorization": f"Bearer {access_token}"},
)
client = Client(transport=transport, fetch_schema_from_transport=True)
Expand Down Expand Up @@ -562,7 +562,7 @@ async def subscribe_to_device_updated(
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_HOST}/api/digital-twin/v3/graphql?access_token={access_token}",
ssl=ssl_context,
)
client = Client(transport=transport, fetch_schema_from_transport=True)
Expand Down Expand Up @@ -602,7 +602,7 @@ async def subscribe_to_location_updated(
) -> None:
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_HOST}/api/digital-twin/v3/graphql?access_token={access_token}"
)
client = Client(transport=transport, fetch_schema_from_transport=True)
query = gql(self.SUBSCRIPTION_LOCATION_UPDATED)
Expand Down
Loading