Show in Assist dialog if assistant is unable to control Home Assistant (#21549)

* Show in Assist dialog if assistant is unable to control Home Assistant

* Update src/translations/en.json
This commit is contained in:
Paulus Schoutsen 2024-08-02 12:31:06 +02:00 committed by GitHub
parent edbfc22bf8
commit 73617711ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 22 additions and 0 deletions

View File

@ -1,6 +1,10 @@
import { ensureArray } from "../common/array/ensure-array";
import { HomeAssistant } from "../types";
export const enum ConversationEntityFeature {
CONTROL = 1,
}
interface IntentTarget {
type: "area" | "device" | "entity" | "domain" | "device_class" | "custom";
name: string;

View File

@ -41,6 +41,8 @@ import { AudioRecorder } from "../../util/audio-recorder";
import { documentationUrl } from "../../util/documentation-url";
import { showAlertDialog } from "../generic/show-dialog-box";
import { VoiceCommandDialogParams } from "./show-ha-voice-command-dialog";
import { supportsFeature } from "../../common/entity/supports-feature";
import { ConversationEntityFeature } from "../../data/conversation";
interface Message {
who: string;
@ -136,6 +138,12 @@ export class HaVoiceCommandDialog extends LitElement {
return nothing;
}
const controlHA = !this._pipeline
? false
: supportsFeature(
this.hass.states[this._pipeline?.conversation_engine],
ConversationEntityFeature.CONTROL
);
const supportsMicrophone = AudioRecorder.isSupported;
const supportsSTT = this._pipeline?.stt_engine;
@ -212,6 +220,15 @@ export class HaVoiceCommandDialog extends LitElement {
></ha-icon-button>
</a>
</ha-dialog-header>
${controlHA
? nothing
: html`
<ha-alert>
${this.hass.localize(
"ui.dialogs.voice_command.conversation_no_control"
)}
</ha-alert>
`}
<div class="messages">
<div class="messages-container" id="scroll-container">
${this._conversation!.map(

View File

@ -1129,6 +1129,7 @@
"did_not_understand": "Didn't quite get that",
"found": "I found the following for you:",
"error": "Oops, an error has occurred",
"conversation_no_control": "This assistant cannot control your home.",
"how_can_i_help": "How can I assist?",
"input_label": "Enter a request",
"send_text": "Send text",