Skip to content

Commit 6a4d079

Browse files
committed
Change print statements to debug logging
1 parent 56fc120 commit 6a4d079

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pyhilo/graphql.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from gql.transport.websockets import WebsocketsTransport
77

88
from pyhilo import API
9+
from pyhilo.const import LOG
910
from pyhilo.device.graphql_value_mapper import GraphqlValueMapper
1011
from pyhilo.devices import Devices
1112

@@ -557,12 +558,12 @@ async def subscribe_to_device_updated(
557558
async for result in session.subscribe(
558559
query, variable_values={"locationHiloId": location_hilo_id}
559560
):
560-
print(f"Received subscription result {result}")
561+
LOG.debug(f"Received subscription result {result}")
561562
device_hilo_id = self._handle_device_subscription_result(result)
562563
if callback:
563564
callback(device_hilo_id)
564565
except Exception as e:
565-
print(f"Connection lost: {e}. Reconnecting in 5 seconds...")
566+
LOG.debug(f"Connection lost: {e}. Reconnecting in 5 seconds...")
566567
await asyncio.sleep(5)
567568
await self.call_get_location_query(location_hilo_id)
568569

@@ -580,11 +581,11 @@ async def subscribe_to_location_updated(
580581
async for result in session.subscribe(
581582
query, variable_values={"locationHiloId": location_hilo_id}
582583
):
583-
print(f"Received subscription result {result}")
584+
LOG.debug(f"Received subscription result {result}")
584585
device_hilo_id = self._handle_location_subscription_result(result)
585586
callback(device_hilo_id)
586587
except asyncio.CancelledError:
587-
print("Subscription cancelled.")
588+
LOG.debug("Subscription cancelled.")
588589
asyncio.sleep(1)
589590
await self.subscribe_to_location_updated(location_hilo_id)
590591

@@ -602,13 +603,13 @@ def _handle_device_subscription_result(self, result: Dict[str, Any]) -> str:
602603
attributes = self.mapper.map_device_subscription_values(devices_values)
603604
updated_device = self._devices.parse_values_received(attributes)
604605
# callback to update the device in the UI
605-
print(f"Device updated: {updated_device}")
606+
LOG.debug(f"Device updated: {updated_device}")
606607
return devices_values.get("hiloId")
607608

608609
def _handle_location_subscription_result(self, result: Dict[str, Any]) -> str:
609610
devices_values: list[any] = result["onAnyLocationUpdated"]["location"]
610611
attributes = self.mapper.map_location_subscription_values(devices_values)
611612
updated_device = self._devices.parse_values_received(attributes)
612613
# callback to update the device in the UI
613-
print(f"Device updated: {updated_device}")
614+
LOG.debug(f"Device updated: {updated_device}")
614615
return devices_values.get("hiloId")

0 commit comments

Comments
 (0)