From e4a7cd8831c93928c16f10eefdb88bc7b6fd9cfc Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Fri, 27 Sep 2024 18:07:45 +0200 Subject: [PATCH] Add missing voice assistant select action logic --- .../voice-assistant-setup-step-success.ts | 113 +++++++++++------- 1 file changed, 72 insertions(+), 41 deletions(-) diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts index 1e2d264f6712..535dbc510e13 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts @@ -14,6 +14,7 @@ import { import { assistSatelliteAnnounce, AssistSatelliteConfiguration, + setWakeWords, } from "../../data/assist_satellite"; import { fetchCloudStatus } from "../../data/cloud"; import { showVoiceAssistantPipelineDetailDialog } from "../../panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail"; @@ -21,6 +22,8 @@ import "../../panels/lovelace/entity-rows/hui-select-entity-row"; import { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; +import { setSelectOption } from "../../data/select"; +import { InputSelectEntity } from "../../data/input_select"; @customElement("ha-voice-assistant-setup-step-success") export class HaVoiceAssistantSetupStepSuccess extends LitElement { @@ -58,7 +61,9 @@ export class HaVoiceAssistantSetupStepSuccess extends LitElement { protected override render() { const pipelineEntity = this.assistConfiguration - ? this.hass.states[this.assistConfiguration.pipeline_entity_id] + ? (this.hass.states[ + this.assistConfiguration.pipeline_entity_id + ] as InputSelectEntity) : undefined; return html`
@@ -69,46 +74,53 @@ export class HaVoiceAssistantSetupStepSuccess extends LitElement { settings, you can change that below.

-
- - ${this.assistConfiguration?.available_wake_words.map( - (wakeword) => - html` - ${wakeword.wake_word} - ` - )} - - - - Test - -
-
- - ${pipelineEntity?.attributes.options.map( - (pipeline) => - html` - ${this.hass.formatEntityState(pipelineEntity, pipeline)} - ` - )} - - - - Edit - -
+ ${this.assistConfiguration && + this.assistConfiguration.available_wake_words.length > 1 + ? html`
+ + ${this.assistConfiguration.available_wake_words.map( + (wakeword) => + html` + ${wakeword.wake_word} + ` + )} + + + + Test + +
` + : nothing} + ${pipelineEntity + ? html`
+ + ${pipelineEntity?.attributes.options.map( + (pipeline) => + html` + ${this.hass.formatEntityState(pipelineEntity, pipeline)} + ` + )} + + + + Edit + +
` + : nothing} ${this._ttsSettings ? html`