Skip to content

Commit

Permalink
handle unknown state for update voice assitant (#22196)
Browse files Browse the repository at this point in the history
* handle unknown state for update voice assitant

* Update voice-assistant-setup-step-update.ts
  • Loading branch information
bramkragten authored Oct 2, 2024
1 parent a30e0d3 commit 487795b
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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;
}
}
}
Expand All @@ -58,7 +59,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
return html`<div class="content">
<img src="/static/icons/casita/loading.png" />
<h1>
${stateObj.state === OFF
${stateObj.state === OFF || stateObj.state === UNKNOWN
? "Checking for updates"
: "Updating your voice assistant"}
</h1>
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 487795b

Please sign in to comment.