From a2955ceab437d3317ccb9a6f02c434ce599fc5f5 Mon Sep 17 00:00:00 2001 From: Clawd Date: Mon, 23 Feb 2026 19:54:06 +0000 Subject: [PATCH] Fix debug log spam by gating debug logs with config.debuglogging - Added config.debuglogging check to 'Found listening connection' debug log - Added config.debuglogging check to 'Hass WS Disconnected' debug log - Prevents log spam when debuglogging is disabled (default) - Fixes issue causing multi-GB log files from frequent state change events --- node_helper.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/node_helper.js b/node_helper.js index c34dd6d..be2c0ad 100644 --- a/node_helper.js +++ b/node_helper.js @@ -229,7 +229,9 @@ function onStateChangedEvent(event) { } for (const connection in this.connections) { if (this.connections[connection].entities.includes(event.data.entity_id)) { - this.logger.debug(`Found listening connection (${connection}) for entity ${event.data.entity_id}`); + if (config.debuglogging) { + this.logger.debug(`Found listening connection (${connection}) for entity ${event.data.entity_id}`); + } this.sendSocketNotification("CHANGED_STATE", { identifier: connection, cause: event.data.entity_id, @@ -241,7 +243,9 @@ function onStateChangedEvent(event) { function onWebsocketCloseEvent(event) { for (const connection in this.connections) { if (event.target == this.connections[connection].websocket.rawClient.ws) { - this.logger.debug(`Hass WS Disconnected (${connection})`); + if (config.debuglogging) { + this.logger.debug(`Hass WS Disconnected (${connection})`); + } this.sendSocketNotification("HASSWS_DISCONNECTED", { identifier: connection, });