Skip to content

Commit

Permalink
Revert remove hass debug connection in dev (#23356)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Dec 20, 2024
1 parent ecc704e commit c532a90
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/state/connection-mixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -167,22 +167,22 @@ 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);
}
conn.sendMessage(msg);
},
// 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),
Expand Down

0 comments on commit c532a90

Please sign in to comment.