Skip to content

Commit 60e5297

Browse files
committed
Comment and old stuff cleanup
1 parent 95cb1e7 commit 60e5297

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

pyhilo/api.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ async def async_get_access_token(self) -> str:
140140
await self._oauth_session.async_ensure_token_valid()
141141

142142
access_token = str(self._oauth_session.token["access_token"])
143-
LOG.debug(f"ic-dev21 access token is {access_token}")
143+
LOG.debug(f"Websocket access token is {access_token}")
144144

145145
return str(self._oauth_session.token["access_token"])
146146

@@ -238,9 +238,8 @@ async def _async_request(
238238
kwargs["headers"]["authorization"] = f"Bearer {access_token}"
239239
kwargs["headers"]["Host"] = host
240240

241-
# ic-dev21 trying Leicas suggestion
242241
if endpoint.startswith(AUTOMATION_CHALLENGE_ENDPOINT):
243-
# remove Ocp-Apim-Subscription-Key header to avoid 401 error
242+
# remove Ocp-Apim-Subscription-Key header to avoid 401 error (Thanks Leicas)
244243
kwargs["headers"].pop("Ocp-Apim-Subscription-Key", None)
245244
kwargs["headers"]["authorization"] = f"Bearer {access_token}"
246245

@@ -369,7 +368,7 @@ def enable_request_retries(self) -> None:
369368

370369
async def _async_post_init(self) -> None:
371370
"""Perform some post-init actions."""
372-
LOG.debug("Websocket postinit")
371+
LOG.debug("Websocket _async_post_init running")
373372
await self._get_fid()
374373
await self._get_device_token()
375374

pyhilo/oauth2.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
"""Custom OAuth2 implementation."""
22

3-
import base64
4-
import hashlib
5-
import os
6-
import re
73
from typing import Any, cast
84

95
from homeassistant.core import HomeAssistant

pyhilo/oauth2helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
AUTH_TOKEN,
1313
)
1414

15+
1516
class OAuth2Helper:
1617
"""Custom OAuth2 implementation."""
1718

pyhilo/websocket.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ async def _async_send_json(self, payload: dict[str, Any]) -> None:
218218
)
219219
# Hilo added a control character (chr(30)) at the end of each payload they send.
220220
# They also expect this char to be there at the end of every payload we send them.
221-
LOG.debug(f"ic-dev21 send_json {payload}")
221+
LOG.debug(f"WebsocketClient _async_send_json payload: {payload}")
222222
await self._client.send_str(json.dumps(payload) + chr(30))
223223

224224
def _parse_message(self, msg: dict[str, Any]) -> None:
@@ -378,7 +378,7 @@ async def async_invoke(
378378
return
379379
self._ready_event.clear()
380380
LOG.debug(
381-
f"ic-dev21 invoke argument: {arg}, invocationId: {inv_id}, target: {target}, type: {type}"
381+
f"async_invoke invoke argument: {arg}, invocationId: {inv_id}, target: {target}, type: {type}"
382382
)
383383
await self._async_send_json(
384384
{
@@ -436,9 +436,7 @@ def __init__(
436436

437437
async def initialize_websockets(self) -> None:
438438
"""Initialize both websocket connections"""
439-
# ic-dev21 get token from device hub
440439
await self.refresh_token(self.devicehub, get_new_token=True)
441-
# ic-dev21 get token from challenge hub
442440
await self.refresh_token(self.challengehub, get_new_token=True)
443441

444442
async def refresh_token(

0 commit comments

Comments
 (0)