;
+ private _timeout?: number;
+
disconnectedCallback(): void {
super.disconnectedCallback();
this._stopListeningWakeWord();
@@ -35,10 +46,25 @@ export class HaVoiceAssistantSetupStepWakeWord extends LitElement {
if (changedProperties.has("assistEntityId")) {
this._detected = false;
+ this._muteSwitchEntity = this.deviceEntities?.find(
+ (ent) =>
+ computeDomain(ent.entity_id) === "switch" &&
+ ent.entity_id.includes("mute")
+ )?.entity_id;
+ if (!this._muteSwitchEntity) {
+ this._startTimeOut();
+ }
this._listenWakeWord();
}
}
+ private _startTimeOut() {
+ this._timeout = window.setTimeout(() => {
+ this._timeout = undefined;
+ this._timedout = true;
+ }, 15000);
+ }
+
private _activeWakeWord = memoizeOne(
(config: AssistSatelliteConfiguration | undefined) => {
if (!config) {
@@ -78,6 +104,16 @@ export class HaVoiceAssistantSetupStepWakeWord extends LitElement {
To make sure the wake word works for you.
`}
+ ${this._timedout
+ ? html`We have not heard the wake word, is your device muted?`
+ : this._muteSwitchEntity &&
+ this.hass.states[this._muteSwitchEntity].state === "on"
+ ? html`Please unmute your device to continue.`
+ : nothing}