Remove debug log spam from hot path entirely
Some checks failed
Release Drafter / update_release_draft (push) Failing after 4s

The conditional config.debuglogging checks were not working reliably
in node_helper context. Removed debug logging from onStateChangedEvent
entirely (it fires on every entity state change - multiple times per
second for power sensors). WS disconnect promoted to info level since
it's actually useful.
This commit is contained in:
Clawd
2026-02-23 20:11:51 +00:00
parent a2955ceab4
commit 8831ee9e13

View File

@@ -224,14 +224,8 @@ async function reconnectWebsocket(payload) {
} }
function onStateChangedEvent(event) { function onStateChangedEvent(event) {
if (config.debuglogging) {
this.logger.debug(`Got state change for ${event.data.entity_id}`);
}
for (const connection in this.connections) { for (const connection in this.connections) {
if (this.connections[connection].entities.includes(event.data.entity_id)) { if (this.connections[connection].entities.includes(event.data.entity_id)) {
if (config.debuglogging) {
this.logger.debug(`Found listening connection (${connection}) for entity ${event.data.entity_id}`);
}
this.sendSocketNotification("CHANGED_STATE", { this.sendSocketNotification("CHANGED_STATE", {
identifier: connection, identifier: connection,
cause: event.data.entity_id, cause: event.data.entity_id,
@@ -243,9 +237,7 @@ function onStateChangedEvent(event) {
function onWebsocketCloseEvent(event) { function onWebsocketCloseEvent(event) {
for (const connection in this.connections) { for (const connection in this.connections) {
if (event.target == this.connections[connection].websocket.rawClient.ws) { if (event.target == this.connections[connection].websocket.rawClient.ws) {
if (config.debuglogging) { this.logger.info(`Hass WS Disconnected (${connection})`);
this.logger.debug(`Hass WS Disconnected (${connection})`);
}
this.sendSocketNotification("HASSWS_DISCONNECTED", { this.sendSocketNotification("HASSWS_DISCONNECTED", {
identifier: connection, identifier: connection,
}); });