@@ -214,18 +214,22 @@ async def _async_send_json(self, payload: dict[str, Any]) -> None:
214214
215215 if self ._api .log_traces :
216216 LOG .debug (
217- f"[TRACE] Sending data to websocket { self ._api .endpoint } : { json .dumps (payload )} "
217+ "[TRACE] Sending data to websocket %s : %s" ,
218+ self ._api .endpoint ,
219+ json .dumps (payload ),
218220 )
219221 # Hilo added a control character (chr(30)) at the end of each payload they send.
220222 # They also expect this char to be there at the end of every payload we send them.
221- LOG .debug (f "WebsocketClient _async_send_json payload: { payload } " )
223+ LOG .debug ("WebsocketClient _async_send_json payload: %s" , payload )
222224 await self ._client .send_str (json .dumps (payload ) + chr (30 ))
223225
224226 def _parse_message (self , msg : dict [str , Any ]) -> None :
225227 """Parse an incoming message."""
226228 if self ._api .log_traces :
227229 LOG .debug (
228- f"[TRACE] Received message on websocket(_parse_message) { self ._api .endpoint } : { msg } "
230+ "[TRACE] Received message on websocket(_parse_message) %s: %s" ,
231+ self ._api .endpoint ,
232+ msg ,
229233 )
230234 if msg .get ("type" ) == SignalRMsgType .PING :
231235 schedule_callback (self ._async_pong )
@@ -272,7 +276,7 @@ async def async_connect(self) -> None:
272276
273277 LOG .info ("Websocket: Connecting to server %s" , self ._api .endpoint )
274278 if self ._api .log_traces :
275- LOG .debug (f "[TRACE] Websocket URL: { self ._api .full_ws_url } " )
279+ LOG .debug ("[TRACE] Websocket URL: %s" , self ._api .full_ws_url )
276280 headers = {
277281 "Sec-WebSocket-Extensions" : "permessage-deflate; client_max_window_bits" ,
278282 "Pragma" : "no-cache" ,
@@ -396,9 +400,13 @@ async def async_invoke(
396400 except asyncio .TimeoutError :
397401 return
398402 self ._ready_event .clear ()
399- LOG .debug (
400- f"async_invoke invoke argument: { arg } , invocationId: { inv_id } , target: { target } , type: { type } "
401- )
403+ LOG .debug (
404+ "async_invoke invoke argument: %s, invocationId: %s, target: %s, type: %s" ,
405+ arg ,
406+ inv_id ,
407+ target ,
408+ type ,
409+ )
402410 await self ._async_send_json (
403411 {
404412 "arguments" : arg ,
@@ -481,9 +489,9 @@ async def _negotiate(self, config: WebsocketConfig) -> Tuple[str, str]:
481489 Returns:
482490 Tuple containing the websocket URL and access token
483491 """
484- LOG .debug (f "Getting websocket url for { config .endpoint } " )
492+ LOG .debug ("Getting websocket url for %s" , config .endpoint )
485493 url = f"{ config .endpoint } /negotiate"
486- LOG .debug (f "Negotiate URL is { url } " )
494+ LOG .debug ("Negotiate URL is %s" , url )
487495
488496 resp = await self .async_request ("post" , url )
489497 ws_url = resp .get ("url" )
@@ -513,8 +521,8 @@ async def _get_websocket_params(self, config: WebsocketConfig) -> None:
513521 config: The websocket configuration to get parameters for
514522 """
515523 uri = parse .urlparse (config .url )
516- LOG .debug (f "Getting websocket params for { config .endpoint } " )
517- LOG .debug (f "Getting uri { uri } " )
524+ LOG .debug ("Getting websocket params for %s" , config .endpoint )
525+ LOG .debug ("Getting uri %s" , uri )
518526
519527 resp = await self .async_request (
520528 "post" ,
@@ -529,7 +537,7 @@ async def _get_websocket_params(self, config: WebsocketConfig) -> None:
529537 config .full_ws_url = (
530538 f"{ config .url } &id={ config .connection_id } &access_token={ config .token } "
531539 )
532- LOG .debug (f "Getting full ws URL { config .full_ws_url } " )
540+ LOG .debug ("Getting full ws URL %s" , config .full_ws_url )
533541
534542 transport_dict = resp .get ("availableTransports" , [])
535543 websocket_dict = {
@@ -544,5 +552,5 @@ async def _get_websocket_params(self, config: WebsocketConfig) -> None:
544552 if config .endpoint == AUTOMATION_DEVICEHUB_ENDPOINT
545553 else "websocketChallenges"
546554 )
547- LOG .debug (f "Calling set_state { state_key } _params" )
555+ LOG .debug ("Calling set_state %s_params" , state_key )
548556 await self ._set_state (self ._state_yaml , state_key , websocket_dict )
0 commit comments