Skip to content

Commit 0a954cf

Browse files
authored
Add add-on installation to voice setup flow (#23018)
1 parent 2782b2f commit 0a954cf

File tree

4 files changed

+419
-44
lines changed

4 files changed

+419
-44
lines changed

src/dialogs/voice-assistant-setup/cloud/cloud-step-intro.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class CloudStepIntro extends LitElement {
9393
<a
9494
href="https://www.nabucasa.com"
9595
target="_blank"
96-
rel="noreferrer noopenner"
96+
rel="noreferrer noopener"
9797
>
9898
<ha-button>
9999
<ha-svg-icon .path=${mdiOpenInNew} slot="icon"></ha-svg-icon>

src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts

+39-24
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import "./voice-assistant-setup-step-pipeline";
2222
import "./voice-assistant-setup-step-success";
2323
import "./voice-assistant-setup-step-update";
2424
import "./voice-assistant-setup-step-wake-word";
25+
import "./voice-assistant-setup-step-local";
2526

2627
export const enum STEP {
2728
INIT,
@@ -32,6 +33,7 @@ export const enum STEP {
3233
PIPELINE,
3334
SUCCESS,
3435
CLOUD,
36+
LOCAL,
3537
CHANGE_WAKEWORD,
3638
}
3739

@@ -118,22 +120,24 @@ export class HaVoiceAssistantSetupDialog extends LitElement {
118120
scrimClickAction
119121
>
120122
<ha-dialog-header slot="heading">
121-
${this._previousSteps.length
122-
? html`<ha-icon-button
123-
slot="navigationIcon"
124-
.label=${this.hass.localize("ui.common.back") ?? "Back"}
125-
.path=${mdiChevronLeft}
126-
@click=${this._goToPreviousStep}
127-
></ha-icon-button>`
128-
: this._step !== STEP.UPDATE
123+
${this._step === STEP.LOCAL
124+
? nothing
125+
: this._previousSteps.length
129126
? html`<ha-icon-button
130127
slot="navigationIcon"
131-
.label=${this.hass.localize("ui.dialogs.generic.close") ??
132-
"Close"}
133-
.path=${mdiClose}
134-
@click=${this.closeDialog}
128+
.label=${this.hass.localize("ui.common.back") ?? "Back"}
129+
.path=${mdiChevronLeft}
130+
@click=${this._goToPreviousStep}
135131
></ha-icon-button>`
136-
: nothing}
132+
: this._step !== STEP.UPDATE
133+
? html`<ha-icon-button
134+
slot="navigationIcon"
135+
.label=${this.hass.localize("ui.dialogs.generic.close") ??
136+
"Close"}
137+
.path=${mdiClose}
138+
@click=${this.closeDialog}
139+
></ha-icon-button>`
140+
: nothing}
137141
${this._step === STEP.WAKEWORD ||
138142
this._step === STEP.AREA ||
139143
this._step === STEP.PIPELINE
@@ -145,7 +149,11 @@ export class HaVoiceAssistantSetupDialog extends LitElement {
145149
>`
146150
: nothing}
147151
</ha-dialog-header>
148-
<div class="content" @next-step=${this._goToNextStep}>
152+
<div
153+
class="content"
154+
@next-step=${this._goToNextStep}
155+
@prev-step=${this._goToPreviousStep}
156+
>
149157
${this._step === STEP.UPDATE
150158
? html`<ha-voice-assistant-setup-step-update
151159
.hass=${this.hass}
@@ -197,14 +205,20 @@ export class HaVoiceAssistantSetupDialog extends LitElement {
197205
? html`<ha-voice-assistant-setup-step-cloud
198206
.hass=${this.hass}
199207
></ha-voice-assistant-setup-step-cloud>`
200-
: this._step === STEP.SUCCESS
201-
? html`<ha-voice-assistant-setup-step-success
208+
: this._step === STEP.LOCAL
209+
? html`<ha-voice-assistant-setup-step-local
202210
.hass=${this.hass}
203211
.assistConfiguration=${this
204212
._assistConfiguration}
205-
.assistEntityId=${assistSatelliteEntityId}
206-
></ha-voice-assistant-setup-step-success>`
207-
: nothing}
213+
></ha-voice-assistant-setup-step-local>`
214+
: this._step === STEP.SUCCESS
215+
? html`<ha-voice-assistant-setup-step-success
216+
.hass=${this.hass}
217+
.assistConfiguration=${this
218+
._assistConfiguration}
219+
.assistEntityId=${assistSatelliteEntityId}
220+
></ha-voice-assistant-setup-step-success>`
221+
: nothing}
208222
</div>
209223
</ha-dialog>
210224
`;
@@ -229,17 +243,17 @@ export class HaVoiceAssistantSetupDialog extends LitElement {
229243
this._step = this._previousSteps.pop()!;
230244
}
231245

232-
private _goToNextStep(ev) {
233-
if (ev.detail?.updateConfig) {
246+
private _goToNextStep(ev?: CustomEvent) {
247+
if (ev?.detail?.updateConfig) {
234248
this._fetchAssistConfiguration();
235249
}
236-
if (ev.detail?.nextStep) {
250+
if (ev?.detail?.nextStep) {
237251
this._nextStep = ev.detail.nextStep;
238252
}
239-
if (!ev.detail?.noPrevious) {
253+
if (!ev?.detail?.noPrevious) {
240254
this._previousSteps.push(this._step);
241255
}
242-
if (ev.detail?.step) {
256+
if (ev?.detail?.step) {
243257
this._step = ev.detail.step;
244258
} else if (this._nextStep) {
245259
this._step = this._nextStep;
@@ -294,5 +308,6 @@ declare global {
294308
nextStep?: STEP;
295309
}
296310
| undefined;
311+
"prev-step": undefined;
297312
}
298313
}

0 commit comments

Comments
 (0)