From 0b562a4b1623175e5c51f01e90b7d310e59f115f Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Wed, 23 Oct 2024 03:23:27 -0400 Subject: [PATCH 1/2] Migrate assist device count to satellite entity (#22486) --- src/panels/config/voice-assistants/assist-pref.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) 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 } )} From e16e85195287356ebd95916a6b426b6f282d57d9 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Wed, 23 Oct 2024 09:58:32 +0200 Subject: [PATCH 2/2] Fix invalid var references (#22482) * var-fixes * Prettier --- cast/src/launcher/layout/hc-layout.ts | 2 +- hassio/src/addon-view/config/hassio-addon-config.ts | 2 +- hassio/src/addon-view/info/hassio-addon-info.ts | 2 +- src/components/ha-card.ts | 2 +- src/components/ha-sidebar.ts | 7 +++++-- src/panels/config/logs/error-log-card.ts | 2 +- src/panels/config/logs/system-log-card.ts | 2 +- src/panels/lovelace/cards/hui-calendar-card.ts | 2 +- .../lovelace/editor/badge-editor/hui-badge-picker.ts | 2 +- src/panels/lovelace/editor/card-editor/hui-card-picker.ts | 2 +- 10 files changed, 14 insertions(+), 11 deletions(-) diff --git a/cast/src/launcher/layout/hc-layout.ts b/cast/src/launcher/layout/hc-layout.ts index 31b336cb513e..ec9796475e25 100644 --- a/cast/src/launcher/layout/hc-layout.ts +++ b/cast/src/launcher/layout/hc-layout.ts @@ -88,7 +88,7 @@ class HcLayout extends LitElement { } .card-header { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: var(--ha-card-header-font-size, 24px); letter-spacing: -0.012em; diff --git a/hassio/src/addon-view/config/hassio-addon-config.ts b/hassio/src/addon-view/config/hassio-addon-config.ts index 9cd32b64f7eb..fe66b25bb704 100644 --- a/hassio/src/addon-view/config/hassio-addon-config.ts +++ b/hassio/src/addon-view/config/hassio-addon-config.ts @@ -417,7 +417,7 @@ class HassioAddonConfig extends LitElement { justify-content: space-between; } .header h2 { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: var(--ha-card-header-font-size, 24px); letter-spacing: -0.012em; diff --git a/hassio/src/addon-view/info/hassio-addon-info.ts b/hassio/src/addon-view/info/hassio-addon-info.ts index 0a9ace35a56f..770ca68fc666 100644 --- a/hassio/src/addon-view/info/hassio-addon-info.ts +++ b/hassio/src/addon-view/info/hassio-addon-info.ts @@ -1209,7 +1209,7 @@ class HassioAddonInfo extends LitElement { padding-inline-start: 8px; padding-inline-end: initial; font-size: 24px; - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); } .addon-version { float: var(--float-end); diff --git a/src/components/ha-card.ts b/src/components/ha-card.ts index 38a154a768b3..a4c34b7ac05a 100644 --- a/src/components/ha-card.ts +++ b/src/components/ha-card.ts @@ -43,7 +43,7 @@ export class HaCard extends LitElement { .card-header, :host ::slotted(.card-header) { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: var(--ha-card-header-font-size, 24px); letter-spacing: -0.012em; diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index bd705917aa6e..750076b5f2dd 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -859,11 +859,14 @@ class HaSidebar extends SubscribeMixin(LitElement) { border-bottom: 1px solid transparent; white-space: nowrap; font-weight: 400; - color: var(--sidebar-menu-button-text-color, --primary-text-color); + color: var( + --sidebar-menu-button-text-color, + var(--primary-text-color) + ); border-bottom: 1px solid var(--divider-color); background-color: var( --sidebar-menu-button-background-color, - --primary-background-color + var(--primary-background-color) ); font-size: 20px; align-items: center; diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts index e7c88ef4ac45..8353e4030803 100644 --- a/src/panels/config/logs/error-log-card.ts +++ b/src/panels/config/logs/error-log-card.ts @@ -236,7 +236,7 @@ class ErrorLogCard extends LitElement { } .card-header { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: var(--ha-card-header-font-size, 24px); letter-spacing: -0.012em; diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index 6e9552b58f3f..cba54b0f9e16 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -212,7 +212,7 @@ export class SystemLogCard extends LitElement { } .card-header { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: var(--ha-card-header-font-size, 24px); letter-spacing: -0.012em; diff --git a/src/panels/lovelace/cards/hui-calendar-card.ts b/src/panels/lovelace/cards/hui-calendar-card.ts index e791db6a5d79..faa886b1baba 100644 --- a/src/panels/lovelace/cards/hui-calendar-card.ts +++ b/src/panels/lovelace/cards/hui-calendar-card.ts @@ -231,7 +231,7 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard { } .header { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-size: var(--ha-card-header-font-size, 24px); line-height: 1.2; padding-top: 16px; diff --git a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts index 81edb16c9f3e..00e18f08c315 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts @@ -514,7 +514,7 @@ export class HuiBadgePicker extends LitElement { } .badge-header { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: 16px; font-weight: bold; diff --git a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts index c8686a4dfe10..60d95b5e229f 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts @@ -509,7 +509,7 @@ export class HuiCardPicker extends LitElement { } .card-header { - color: var(--ha-card-header-color, --primary-text-color); + color: var(--ha-card-header-color, var(--primary-text-color)); font-family: var(--ha-card-header-font-family, inherit); font-size: 16px; font-weight: bold;