mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 09:16:38 +00:00
Fix showing options button on conversation agent picker (#20736)
This commit is contained in:
parent
bc41de0d9c
commit
008c842431
@ -19,6 +19,7 @@ import { HomeAssistant } from "../types";
|
|||||||
import "./ha-list-item";
|
import "./ha-list-item";
|
||||||
import "./ha-select";
|
import "./ha-select";
|
||||||
import type { HaSelect } from "./ha-select";
|
import type { HaSelect } from "./ha-select";
|
||||||
|
import { getExtendedEntityRegistryEntry } from "../data/entity_registry";
|
||||||
|
|
||||||
const NONE = "__NONE_OPTION__";
|
const NONE = "__NONE_OPTION__";
|
||||||
|
|
||||||
@ -107,13 +108,23 @@ export class HaConversationAgentPicker extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async _maybeFetchConfigEntry() {
|
private async _maybeFetchConfigEntry() {
|
||||||
if (!this.value || this.value === "homeassistant") {
|
if (!this.value || !(this.value in this.hass.entities)) {
|
||||||
this._configEntry = undefined;
|
this._configEntry = undefined;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
const regEntry = await getExtendedEntityRegistryEntry(
|
||||||
|
this.hass,
|
||||||
|
this.value
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!regEntry.config_entry_id) {
|
||||||
|
this._configEntry = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._configEntry = (
|
this._configEntry = (
|
||||||
await getConfigEntry(this.hass, this.value)
|
await getConfigEntry(this.hass, regEntry.config_entry_id)
|
||||||
).config_entry;
|
).config_entry;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this._configEntry = undefined;
|
this._configEntry = undefined;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user