From 21180d066e144b8d2beb17715ce4b47be59d489c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 7 Apr 2025 15:52:06 +0200 Subject: [PATCH] Allow to turn of `debugConnection` in dev (#24956) --- src/state/connection-mixin.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/state/connection-mixin.ts b/src/state/connection-mixin.ts index 87b6aa4f2a..725201f6cd 100644 --- a/src/state/connection-mixin.ts +++ b/src/state/connection-mixin.ts @@ -76,7 +76,7 @@ export const connectionMixin = >( translationMetadata, dockedSidebar: "docked", vibrate: true, - debugConnection: false, + debugConnection: __DEV__, suspendWhenHidden: true, enableShortcuts: true, moreInfoEntityId: null, @@ -89,7 +89,7 @@ export const connectionMixin = >( notifyOnError = true, returnResponse = false ) => { - if (__DEV__ || this.hass?.debugConnection) { + if (this.hass?.debugConnection) { // eslint-disable-next-line no-console console.log( "Calling service", @@ -115,7 +115,7 @@ export const connectionMixin = >( ) { return { context: { id: "" } }; } - if (__DEV__ || this.hass?.debugConnection) { + if (this.hass?.debugConnection) { // eslint-disable-next-line no-console console.error( "Error calling service", @@ -167,7 +167,7 @@ export const connectionMixin = >( ) => fetchWithAuth(auth, `${auth.data.hassUrl}${path}`, init), // For messages that do not get a response sendWS: (msg) => { - if (__DEV__ || this.hass?.debugConnection) { + if (this.hass?.debugConnection) { // eslint-disable-next-line no-console console.log("Sending", msg); } @@ -175,14 +175,14 @@ export const connectionMixin = >( }, // For messages that expect a response callWS: (msg) => { - if (__DEV__ || this.hass?.debugConnection) { + if (this.hass?.debugConnection) { // eslint-disable-next-line no-console console.log("Sending", msg); } const resp = conn.sendMessagePromise(msg); - if (__DEV__ || this.hass?.debugConnection) { + if (this.hass?.debugConnection) { resp.then( // eslint-disable-next-line no-console (result) => console.log("Received", result),