diff --git a/src/panels/config/integrations/dialog-add-integration.ts b/src/panels/config/integrations/dialog-add-integration.ts index 722cc7b5a4e4..afb176a4aa8f 100644 --- a/src/panels/config/integrations/dialog-add-integration.ts +++ b/src/panels/config/integrations/dialog-add-integration.ts @@ -52,7 +52,7 @@ import "./ha-domain-integrations"; import "./ha-integration-list-item"; import { AddIntegrationDialogParams, - showSingleInstanceOnlyDialog, + showSingleConfigEntryOnlyDialog, showYamlIntegrationDialog, } from "./show-add-integration-dialog"; import { getConfigEntries } from "../../../data/config_entries"; @@ -582,7 +582,7 @@ class AddIntegrationDialog extends LitElement { }); if (configEntries.length > 0) { this.closeDialog(); - showSingleInstanceOnlyDialog(this, { integration }); + showSingleConfigEntryOnlyDialog(this, { name: integration.name }); return; } } diff --git a/src/panels/config/integrations/dialog-single-instance-only.ts b/src/panels/config/integrations/dialog-single-config-entry-only.ts similarity index 78% rename from src/panels/config/integrations/dialog-single-instance-only.ts rename to src/panels/config/integrations/dialog-single-config-entry-only.ts index 4b985696d17f..bd20f8924038 100644 --- a/src/panels/config/integrations/dialog-single-instance-only.ts +++ b/src/panels/config/integrations/dialog-single-config-entry-only.ts @@ -3,15 +3,15 @@ import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { HomeAssistant } from "../../../types"; -import { SingleInstanceOnlyDialogParams } from "./show-add-integration-dialog"; +import { SingleConfigEntryOnlyDialogParams } from "./show-add-integration-dialog"; -@customElement("dialog-single-instance-only") -export class DialogSingleInstanceOnly extends LitElement { +@customElement("dialog-single-config-entry-only") +export class DialogSingleConfigEntryOnly extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @state() private _params?: SingleInstanceOnlyDialogParams; + @state() private _params?: SingleConfigEntryOnlyDialogParams; - public showDialog(params: SingleInstanceOnlyDialogParams): void { + public showDialog(params: SingleConfigEntryOnlyDialogParams): void { this._params = params; } @@ -36,7 +36,7 @@ export class DialogSingleInstanceOnly extends LitElement { ${this.hass.localize( "ui.panel.config.integrations.config_flow.single_config_entry", { - integration_name: this._params.integration.name, + integration_name: this._params.name, } )}
@@ -71,6 +71,6 @@ export class DialogSingleInstanceOnly extends LitElement { declare global { interface HTMLElementTagNameMap { - "dialog-single-instance-only": DialogSingleInstanceOnly; + "dialog-single-config-entry-only": DialogSingleConfigEntryOnly; } } diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index a0c6edf1a895..a706efedd01a 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -37,6 +37,7 @@ import { import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; +import { ifDefined } from "lit/directives/if-defined"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { isDevVersion } from "../../../common/config/version"; import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; @@ -242,6 +243,8 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { const entities = this._getEntities(configEntries, this._entities); const services = !devices.some((device) => device.entry_type !== "service"); + const single_config_entry_only = + this._manifest?.single_config_entry && configEntries.length > 0; return html`