mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Migrate assist device count to satellite entity (#22486)
This commit is contained in:
parent
7734922059
commit
0b562a4b16
@ -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 {
|
||||
)}
|
||||
</ha-button>
|
||||
</a>
|
||||
${this._devices?.length
|
||||
${this._pipelineEntitiesCount > 0
|
||||
? html`
|
||||
<a href="/config/voice-assistants/assist/devices">
|
||||
<ha-button>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.voice_assistants.assistants.pipeline.assist_devices",
|
||||
{ number: this._devices.length }
|
||||
{ number: this._pipelineEntitiesCount }
|
||||
)}
|
||||
</ha-button>
|
||||
</a>
|
||||
|
Loading…
x
Reference in New Issue
Block a user