diff --git a/src/panels/config/voice-assistants/assist-pref.ts b/src/panels/config/voice-assistants/assist-pref.ts index bb8ff2900880..c7d6d6646255 100644 --- a/src/panels/config/voice-assistants/assist-pref.ts +++ b/src/panels/config/voice-assistants/assist-pref.ts @@ -21,11 +21,9 @@ import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; import "../../../components/ha-switch"; import { - AssistDevice, AssistPipeline, createAssistPipeline, deleteAssistPipeline, - listAssistDevices, listAssistPipelines, setAssistPipelinePreferred, updateAssistPipeline, @@ -42,6 +40,7 @@ import { documentationUrl } from "../../../util/documentation-url"; import { showVoiceAssistantPipelineDetailDialog } from "./show-dialog-voice-assistant-pipeline-detail"; import { showVoiceCommandDialog } from "../../../dialogs/voice-command-dialog/show-ha-voice-command-dialog"; import { stopPropagation } from "../../../common/dom/stop_propagation"; +import { computeDomain } from "../../../common/entity/compute_domain"; @customElement("assist-pref") export class AssistPref extends LitElement { @@ -58,7 +57,7 @@ export class AssistPref extends LitElement { @state() private _preferred: string | null = null; - @state() private _devices: AssistDevice[] = []; + @state() private _pipelineEntitiesCount = 0; protected firstUpdated(changedProps: PropertyValues) { super.firstUpdated(changedProps); @@ -67,9 +66,9 @@ export class AssistPref extends LitElement { this._pipelines = pipelines.pipelines; this._preferred = pipelines.preferred_pipeline; }); - listAssistDevices(this.hass).then((devices) => { - this._devices = devices; - }); + this._pipelineEntitiesCount = Object.values(this.hass.entities).filter( + (entity) => computeDomain(entity.entity_id) === "assist_satellite" + ).length; } private _exposedEntitiesCount = memoizeOne( @@ -205,13 +204,13 @@ export class AssistPref extends LitElement { )} - ${this._devices?.length + ${this._pipelineEntitiesCount > 0 ? html` ${this.hass.localize( "ui.panel.config.voice_assistants.assistants.pipeline.assist_devices", - { number: this._devices.length } + { number: this._pipelineEntitiesCount } )}