mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
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:
parent
edbfc22bf8
commit
73617711ff
@ -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;
|
||||
|
@ -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(
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user