Allow to turn of debugConnection in dev (#24956)

This commit is contained in:
Bram Kragten 2025-04-07 15:52:06 +02:00 committed by GitHub
parent dec968af54
commit 21180d066e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -76,7 +76,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
translationMetadata,
dockedSidebar: "docked",
vibrate: true,
debugConnection: false,
debugConnection: __DEV__,
suspendWhenHidden: true,
enableShortcuts: true,
moreInfoEntityId: null,
@ -89,7 +89,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
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 = <T extends Constructor<HassBaseEl>>(
) {
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 = <T extends Constructor<HassBaseEl>>(
) => 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 = <T extends Constructor<HassBaseEl>>(
},
// For messages that expect a response
callWS: <R>(msg) => {
if (__DEV__ || this.hass?.debugConnection) {
if (this.hass?.debugConnection) {
// eslint-disable-next-line no-console
console.log("Sending", msg);
}
const resp = conn.sendMessagePromise<R>(msg);
if (__DEV__ || this.hass?.debugConnection) {
if (this.hass?.debugConnection) {
resp.then(
// eslint-disable-next-line no-console
(result) => console.log("Received", result),