Revert remove hass debug connection in dev (#23356)

This commit is contained in:
Paul Bottein 2024-12-20 14:05:33 +01:00 committed by GitHub
parent ecc704e6ac
commit c532a9023a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -89,7 +89,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
notifyOnError = true,
returnResponse = false
) => {
if (this.hass?.debugConnection) {
if (__DEV__ || 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 (this.hass?.debugConnection) {
if (__DEV__ || 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 (this.hass?.debugConnection) {
if (__DEV__ || 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 (this.hass?.debugConnection) {
if (__DEV__ || this.hass?.debugConnection) {
// eslint-disable-next-line no-console
console.log("Sending", msg);
}
const resp = conn.sendMessagePromise<R>(msg);
if (this.hass?.debugConnection) {
if (__DEV__ || this.hass?.debugConnection) {
resp.then(
// eslint-disable-next-line no-console
(result) => console.log("Received", result),