Skip to content

Commit

Permalink
silent option affects more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jsl12 committed Jan 27, 2025
1 parent fe47d32 commit 1e5be6e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions appdaemon/plugins/hass/hassplugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down

0 comments on commit 1e5be6e

Please sign in to comment.