From 1e5be6ef5820c314c3c0597262692dc25e124ea6 Mon Sep 17 00:00:00 2001 From: John Lancaster <32917998+jsl12@users.noreply.github.com> Date: Sun, 26 Jan 2025 23:35:47 -0600 Subject: [PATCH] silent option affects more logs --- appdaemon/plugins/hass/hassplugin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/appdaemon/plugins/hass/hassplugin.py b/appdaemon/plugins/hass/hassplugin.py index ba98ebb5e..8127c5fe1 100644 --- a/appdaemon/plugins/hass/hassplugin.py +++ b/appdaemon/plugins/hass/hassplugin.py @@ -283,8 +283,9 @@ async def websocket_send_json(self, timeout: float = 5.0, silent: bool = False, self.id += 1 request["id"] = self.id - # include this in the "not auth" section so we don't accidentally put the token in the logs - self.logger.debug(f"Sending JSON: {request}") + if not silent: + # include this in the "not auth" section so we don't accidentally put the token in the logs + self.logger.debug(f"Sending JSON: {request}") send_time = perf_counter() try: @@ -308,7 +309,8 @@ async def websocket_send_json(self, timeout: float = 5.0, silent: bool = False, try: result: dict = await asyncio.wait_for(future, timeout=timeout) except asyncio.TimeoutError: - self.logger.warning(f"Timed out [{timeout:.0f}s] waiting for request: %s", request) + if not silent: + self.logger.warning(f"Timed out [{timeout:.0f}s] waiting for request: %s", request) return {"success": "timeout", "ad_duration": timeout} else: travel_time = perf_counter() - send_time