mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
handle unknown state for update voice assitant (#22196)
* handle unknown state for update voice assitant * Update voice-assistant-setup-step-update.ts
This commit is contained in:
parent
a30e0d33f9
commit
487795b7c4
@ -2,7 +2,7 @@ import { css, html, LitElement, nothing, PropertyValues } from "lit";
|
|||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import "../../components/ha-circular-progress";
|
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 { HomeAssistant } from "../../types";
|
||||||
import { AssistantSetupStyles } from "./styles";
|
import { AssistantSetupStyles } from "./styles";
|
||||||
|
|
||||||
@ -32,10 +32,11 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
|
|||||||
if (
|
if (
|
||||||
(oldState?.state === UNAVAILABLE &&
|
(oldState?.state === UNAVAILABLE &&
|
||||||
newState?.state !== UNAVAILABLE) ||
|
newState?.state !== UNAVAILABLE) ||
|
||||||
(oldState?.state === OFF && newState?.state === ON)
|
(oldState?.state !== ON && newState?.state === ON)
|
||||||
) {
|
) {
|
||||||
// Device is rebooted, let's move on
|
// Device is rebooted, let's move on
|
||||||
this._tryUpdate(false);
|
this._tryUpdate(false);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,7 +59,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
|
|||||||
return html`<div class="content">
|
return html`<div class="content">
|
||||||
<img src="/static/icons/casita/loading.png" />
|
<img src="/static/icons/casita/loading.png" />
|
||||||
<h1>
|
<h1>
|
||||||
${stateObj.state === OFF
|
${stateObj.state === OFF || stateObj.state === UNKNOWN
|
||||||
? "Checking for updates"
|
? "Checking for updates"
|
||||||
: "Updating your voice assistant"}
|
: "Updating your voice assistant"}
|
||||||
</h1>
|
</h1>
|
||||||
@ -88,10 +89,7 @@ export class HaVoiceAssistantSetupStepUpdate extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const updateEntity = this.hass.states[this.updateEntityId];
|
const updateEntity = this.hass.states[this.updateEntityId];
|
||||||
if (
|
if (updateEntity && this.hass.states[updateEntity.entity_id].state === ON) {
|
||||||
updateEntity &&
|
|
||||||
this.hass.states[updateEntity.entity_id].state === "on"
|
|
||||||
) {
|
|
||||||
this._updated = true;
|
this._updated = true;
|
||||||
await this.hass.callService(
|
await this.hass.callService(
|
||||||
"update",
|
"update",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user