Skip to content

Commit

Permalink
fix: Only log connected closed once
Browse files Browse the repository at this point in the history
  • Loading branch information
zachowj committed Jul 14, 2023
1 parent 9e7a2eb commit 59bae23
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/homeAssistant/Websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,12 +501,8 @@ export default class Websocket {
}

onClientClose(): void {
this.integrationVersion = 0;
this.isHomeAssistantRunning = false;
this.connectionState = STATE_DISCONNECTED;
this.resetClient();
debug('events connection closed, cleaning up connection');
this.#emitEvent('ha_client:close');
this.resetClient();
}

onClientError(data: unknown): void {
Expand All @@ -526,6 +522,8 @@ export default class Websocket {
}

resetClient(): void {
this.integrationVersion = 0;
this.isHomeAssistantRunning = false;
this.#servicesLoaded = false;
this.#statesLoaded = false;
this.connectionState = STATE_DISCONNECTED;
Expand Down

0 comments on commit 59bae23

Please sign in to comment.