diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts index dfa6f0fd3922..316d21b51607 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts @@ -1,4 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + nothing, + PropertyValues, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { LocalizeKeys } from "../../../../common/translations/localize"; @@ -6,6 +13,7 @@ import "../../../../components/ha-form/ha-form"; import { AssistPipeline } from "../../../../data/assist_pipeline"; import { HomeAssistant } from "../../../../types"; import { fetchWakeWordInfo, WakeWord } from "../../../../data/wake_word"; +import { documentationUrl } from "../../../../util/documentation-url"; @customElement("assist-pipeline-detail-wakeword") export class AssistPipelineDetailWakeWord extends LitElement { @@ -67,7 +75,12 @@ export class AssistPipelineDetailWakeWord extends LitElement { } } + private _hasWakeWorkEntities = memoizeOne((states: HomeAssistant["states"]) => + Object.keys(states).some((entityId) => entityId.startsWith("wake_word.")) + ); + protected render() { + const hasWakeWorkEntities = this._hasWakeWorkEntities(this.hass.states); return html`
@@ -83,11 +96,25 @@ export class AssistPipelineDetailWakeWord extends LitElement { )}

+ ${!hasWakeWorkEntities + ? html`${this.hass.localize( + `ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.wakeword.no_wake_words` + )} + ${this.hass.localize( + `ui.panel.config.voice_assistants.assistants.pipeline.detail.steps.wakeword.no_wake_words_link` + )}` + : nothing}
@@ -129,6 +156,9 @@ export class AssistPipelineDetailWakeWord extends LitElement { margin-top: 0; margin-bottom: 0; } + a { + color: var(--primary-color); + } `; } } diff --git a/src/panels/config/voice-assistants/assist-pref.ts b/src/panels/config/voice-assistants/assist-pref.ts index 65665b9ce7ef..f38173e84f03 100644 --- a/src/panels/config/voice-assistants/assist-pref.ts +++ b/src/panels/config/voice-assistants/assist-pref.ts @@ -25,6 +25,7 @@ import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; import { showVoiceAssistantPipelineDetailDialog } from "./show-dialog-voice-assistant-pipeline-detail"; +import { documentationUrl } from "../../../util/documentation-url"; export class AssistPref extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -73,9 +74,9 @@ export class AssistPref extends LitElement {
*:not(:last-child) { margin-bottom: 16px; display: block; } diff --git a/src/translations/en.json b/src/translations/en.json index 2aae975e3933..230b386b6a94 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -2196,7 +2196,9 @@ }, "wakeword": { "title": "Wake word", - "description": "If a device supports wake words, you can activate Assist by saying this word." + "description": "If a device supports wake words, you can activate Assist by saying this word.", + "no_wake_words": "It looks like you don't have a wake word engine setup yet.", + "no_wake_words_link": "Find out more about wake words." } }, "no_cloud_message": "You should have an active cloud subscription to use cloud speech services.",