diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 74f5be55d6..5533e89a8d 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -64,6 +64,10 @@ import "./ha-config-entry-row"; import type { DataEntryFlowProgressExtended } from "./ha-config-integrations"; import { showAddIntegrationDialog } from "./show-add-integration-dialog"; import { showPickConfigEntryDialog } from "./show-pick-config-entry-dialog"; +import { + PROTOCOL_INTEGRATIONS, + protocolIntegrationPicked, +} from "../../../common/integrations/protocolIntegrationPicked"; export const renderConfigEntryError = ( hass: HomeAssistant, @@ -283,6 +287,10 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { (device) => device.entry_type !== "service" ); + const canAddDevice = (PROTOCOL_INTEGRATIONS as readonly string[]).includes( + this.domain + ); + return html` ${this._manifest @@ -513,7 +521,20 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
- + ${canAddDevice + ? html` + + ${this.hass.localize( + "ui.panel.config.integrations.integration_page.add_device" + )} + + ` + : nothing} + ${this._manifest?.integration_type ? this.hass.localize( `ui.panel.config.integrations.integration_page.add_${this._manifest.integration_type}` @@ -802,6 +823,10 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { } ); + private _addDevice() { + protocolIntegrationPicked(this, this.hass, this.domain); + } + private async _addIntegration() { if (!this._manifest?.config_flow) { showAlertDialog(this, {