diff --git a/pyproject.toml b/pyproject.toml index a864b2fc74..a8bc40d1ce 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20230906.0" +version = "20230906.1" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" diff --git a/src/components/ha-conversation-agent-picker.ts b/src/components/ha-conversation-agent-picker.ts index 30a54871bc..d62a80134d 100644 --- a/src/components/ha-conversation-agent-picker.ts +++ b/src/components/ha-conversation-agent-picker.ts @@ -155,11 +155,12 @@ export class HaConversationAgentPicker extends LitElement { if (!this._configEntry) { return; } - showOptionsFlowDialog( - this, - this._configEntry, - await fetchIntegrationManifest(this.hass, this._configEntry.domain) - ); + showOptionsFlowDialog(this, this._configEntry, { + manifest: await fetchIntegrationManifest( + this.hass, + this._configEntry.domain + ), + }); } static get styles(): CSSResultGroup { diff --git a/src/dialogs/config-flow/previews/flow-preview-group.ts b/src/dialogs/config-flow/previews/flow-preview-group.ts index 25f6d3cb08..11d48cd09f 100644 --- a/src/dialogs/config-flow/previews/flow-preview-group.ts +++ b/src/dialogs/config-flow/previews/flow-preview-group.ts @@ -49,7 +49,7 @@ class FlowPreviewGroup extends LitElement { private _setPreview = (preview: GroupPreview) => { const now = new Date().toISOString(); this._preview = { - entity_id: `${this.stepId}.flow_preview`, + entity_id: `${this.stepId}.___flow_preview___`, last_changed: now, last_updated: now, context: { id: "", parent_id: null, user_id: null }, diff --git a/src/dialogs/config-flow/previews/flow-preview-template.ts b/src/dialogs/config-flow/previews/flow-preview-template.ts index ebd5eb503a..fd337671e3 100644 --- a/src/dialogs/config-flow/previews/flow-preview-template.ts +++ b/src/dialogs/config-flow/previews/flow-preview-template.ts @@ -110,11 +110,11 @@ class FlowPreviewTemplate extends LitElement { ` : !this._listeners.time - ? html` + ? html`

${this.hass.localize( "ui.dialogs.helper_settings.template.no_listeners" )} - ` +

` : nothing} `; } @@ -128,7 +128,7 @@ class FlowPreviewTemplate extends LitElement { this._listeners = preview.listeners; const now = new Date().toISOString(); this._preview = { - entity_id: `${this.stepId}.flow_preview`, + entity_id: `${this.stepId}.___flow_preview___`, last_changed: now, last_updated: now, context: { id: "", parent_id: null, user_id: null }, diff --git a/src/dialogs/config-flow/show-dialog-options-flow.ts b/src/dialogs/config-flow/show-dialog-options-flow.ts index 012f0c580e..eb9595ab50 100644 --- a/src/dialogs/config-flow/show-dialog-options-flow.ts +++ b/src/dialogs/config-flow/show-dialog-options-flow.ts @@ -1,6 +1,6 @@ import { html } from "lit"; import { ConfigEntry } from "../../data/config_entries"; -import { domainToName, IntegrationManifest } from "../../data/integration"; +import { domainToName } from "../../data/integration"; import { createOptionsFlow, deleteOptionsFlow, @@ -8,6 +8,7 @@ import { handleOptionsFlowStep, } from "../../data/options_flow"; import { + DataEntryFlowDialogParams, loadDataEntryFlowDialog, showFlowDialog, } from "./show-dialog-data-entry-flow"; @@ -17,14 +18,14 @@ export const loadOptionsFlowDialog = loadDataEntryFlowDialog; export const showOptionsFlowDialog = ( element: HTMLElement, configEntry: ConfigEntry, - manifest?: IntegrationManifest | null + dialogParams?: Omit ): void => showFlowDialog( element, { startFlowHandler: configEntry.entry_id, domain: configEntry.domain, - manifest, + ...dialogParams, }, { flowType: "options_flow", diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index 773871da14..840e310114 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -1336,7 +1336,7 @@ export class EntityRegistrySettingsEditor extends LitElement { } private async _showOptionsFlow() { - showOptionsFlowDialog(this, this.helperConfigEntry!, null); + showOptionsFlowDialog(this, this.helperConfigEntry!); } private _switchAsDomainsSorted = memoizeOne( diff --git a/src/panels/config/helpers/ha-config-helpers.ts b/src/panels/config/helpers/ha-config-helpers.ts index 4fdd7eafbb..1346cfb5df 100644 --- a/src/panels/config/helpers/ha-config-helpers.ts +++ b/src/panels/config/helpers/ha-config-helpers.ts @@ -1,6 +1,6 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiAlertCircle, mdiPencilOff, mdiPlus } from "@mdi/js"; -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import { HassEntity } from "home-assistant-js-websocket"; import { LitElement, PropertyValues, TemplateResult, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -16,7 +16,10 @@ import "../../../components/ha-fab"; import "../../../components/ha-icon"; import "../../../components/ha-state-icon"; import "../../../components/ha-svg-icon"; -import { ConfigEntry, getConfigEntries } from "../../../data/config_entries"; +import { + ConfigEntry, + subscribeConfigEntries, +} from "../../../data/config_entries"; import { getConfigFlowHandlers } from "../../../data/config_flow"; import { EntityRegistryEntry, @@ -76,6 +79,33 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) { @state() private _configEntries?: Record; + public hassSubscribe() { + return [ + subscribeConfigEntries( + this.hass, + async (messages) => { + const newEntries = this._configEntries + ? { ...this._configEntries } + : {}; + messages.forEach((message) => { + if (message.type === null || message.type === "added") { + newEntries[message.entry.entry_id] = message.entry; + } else if (message.type === "removed") { + delete newEntries[message.entry.entry_id]; + } else if (message.type === "updated") { + newEntries[message.entry.entry_id] = message.entry; + } + }); + this._configEntries = newEntries; + }, + { type: ["helper"] } + ), + subscribeEntityRegistry(this.hass.connection!, (entries) => { + this._entityEntries = groupByOne(entries, (entry) => entry.entity_id); + }), + ]; + } + private _columns = memoizeOne( (narrow: boolean, localize: LocalizeFunc): DataTableColumnContainer => { const columns: DataTableColumnContainer = { @@ -256,7 +286,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) { protected firstUpdated(changedProps: PropertyValues) { super.firstUpdated(changedProps); - this._getConfigEntries(); if (this.route.path === "/add") { this._handleAdd(); } @@ -313,9 +342,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) { return; } showConfigFlowDialog(this, { - dialogClosedCallback: () => { - this._getConfigEntries(); - }, startFlowHandler: domain, showAdvanced: this.hass.userData?.showAdvanced, }); @@ -366,21 +392,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) { } } - public hassSubscribe(): UnsubscribeFunc[] { - return [ - subscribeEntityRegistry(this.hass.connection!, (entries) => { - this._entityEntries = groupByOne(entries, (entry) => entry.entity_id); - }), - ]; - } - - private async _getConfigEntries() { - this._configEntries = groupByOne( - await getConfigEntries(this.hass, { type: ["helper"] }), - (entry) => entry.entry_id - ); - } - private async _openEditDialog(ev: CustomEvent): Promise { const id = (ev.detail as RowClickedEvent).id; if (id.includes(".")) { @@ -391,12 +402,6 @@ export class HaConfigHelpers extends SubscribeMixin(LitElement) { } private _createHelpler() { - showHelperDetailDialog(this, { - dialogClosedCallback: (params) => { - if (params.flowFinished) { - this._getConfigEntries(); - } - }, - }); + showHelperDetailDialog(this, {}); } } diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 0a77867b5b..ab9bab7166 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -1024,7 +1024,7 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) { showOptionsFlowDialog( this, ev.target.closest(".config_entry").configEntry, - this._manifest + { manifest: this._manifest } ); }