From 487795b7c4e0623d7d81f24afe8c12e166f6edb3 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 2 Oct 2024 16:42:27 +0200 Subject: [PATCH] handle unknown state for update voice assitant (#22196) * handle unknown state for update voice assitant * Update voice-assistant-setup-step-update.ts --- .../voice-assistant-setup-step-update.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts index 0f7b14e403..a103fb6a9a 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts @@ -2,7 +2,7 @@ import { css, html, LitElement, nothing, PropertyValues } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-circular-progress"; -import { OFF, ON, UNAVAILABLE } from "../../data/entity"; +import { OFF, ON, UNAVAILABLE, UNKNOWN } from "../../data/entity"; import { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; @@ -32,10 +32,11 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement { if ( (oldState?.state === UNAVAILABLE && newState?.state !== UNAVAILABLE) || - (oldState?.state === OFF && newState?.state === ON) + (oldState?.state !== ON && newState?.state === ON) ) { // Device is rebooted, let's move on this._tryUpdate(false); + return; } } } @@ -58,7 +59,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement { return html`

- ${stateObj.state === OFF + ${stateObj.state === OFF || stateObj.state === UNKNOWN ? "Checking for updates" : "Updating your voice assistant"}

@@ -88,10 +89,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement { return; } const updateEntity = this.hass.states[this.updateEntityId]; - if ( - updateEntity && - this.hass.states[updateEntity.entity_id].state === "on" - ) { + if (updateEntity && this.hass.states[updateEntity.entity_id].state === ON) { this._updated = true; await this.hass.callService( "update",