${cache(
this._currTab === "info"
diff --git a/src/dialogs/more-info/ha-more-info-info.ts b/src/dialogs/more-info/ha-more-info-info.ts
index d66adaed41..df3fe1f901 100644
--- a/src/dialogs/more-info/ha-more-info-info.ts
+++ b/src/dialogs/more-info/ha-more-info-info.ts
@@ -1,9 +1,12 @@
import { LitElement, html, css } from "lit";
-import { customElement, property } from "lit/decorators";
+import { customElement, property, state } from "lit/decorators";
import { computeDomain } from "../../common/entity/compute_domain";
-import { removeEntityRegistryEntry } from "../../data/entity_registry";
+import { subscribeOne } from "../../common/util/subscribe-one";
+import {
+ EntityRegistryEntry,
+ subscribeEntityRegistry,
+} from "../../data/entity_registry";
import type { HomeAssistant } from "../../types";
-import { showConfirmationDialog } from "../generic/show-dialog-box";
import {
computeShowHistoryComponent,
computeShowLogBookComponent,
@@ -19,12 +22,24 @@ export class MoreInfoInfo extends LitElement {
@property() public entityId!: string;
+ @state() private _entityEntry?: EntityRegistryEntry;
+
protected render() {
const entityId = this.entityId;
const stateObj = this.hass.states[entityId];
const domain = computeDomain(entityId);
return html`
+ ${stateObj.attributes.restored && this._entityEntry
+ ? html`
+ ${this.hass.localize(
+ "ui.dialogs.more_info_control.restored.no_longer_provided",
+ {
+ integration: this._entityEntry.platform,
+ }
+ )}
+ `
+ : ""}
${DOMAINS_NO_INFO.includes(domain)
? ""
: html`
@@ -52,43 +67,18 @@ export class MoreInfoInfo extends LitElement {
.stateObj=${stateObj}
.hass=${this.hass}
>
- ${stateObj.attributes.restored
- ? html`
-
- ${this.hass.localize(
- "ui.dialogs.more_info_control.restored.not_provided"
- )}
-
-
- ${this.hass.localize(
- "ui.dialogs.more_info_control.restored.remove_intro"
- )}
-
-
- ${this.hass.localize(
- "ui.dialogs.more_info_control.restored.remove_action"
- )}
-
- `
- : ""}
`;
}
- private _removeEntity() {
- const entityId = this.entityId!;
- showConfirmationDialog(this, {
- title: this.hass.localize(
- "ui.dialogs.more_info_control.restored.confirm_remove_title"
- ),
- text: this.hass.localize(
- "ui.dialogs.more_info_control.restored.confirm_remove_text"
- ),
- confirmText: this.hass.localize("ui.common.remove"),
- dismissText: this.hass.localize("ui.common.cancel"),
- confirm: () => {
- removeEntityRegistryEntry(this.hass, entityId);
- },
- });
+ protected firstUpdated(changedProps) {
+ super.firstUpdated(changedProps);
+ subscribeOne(this.hass.connection, subscribeEntityRegistry).then(
+ (entries) => {
+ this._entityEntry = entries.find(
+ (entry) => entry.entity_id === this.entityId
+ );
+ }
+ );
}
static get styles() {
@@ -99,6 +89,13 @@ export class MoreInfoInfo extends LitElement {
display: block;
margin-bottom: 16px;
}
+
+ ha-alert {
+ display: block;
+ margin: calc(-1 * var(--dialog-content-padding, 24px))
+ calc(-1 * var(--dialog-content-padding, 24px)) 16px
+ calc(-1 * var(--dialog-content-padding, 24px));
+ }
`;
}
}
diff --git a/src/translations/en.json b/src/translations/en.json
index cc38651af5..d82e11a5e7 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -776,11 +776,7 @@
"activity": "Current activity"
},
"restored": {
- "not_provided": "This entity is currently unavailable and is an orphan to a removed, changed or dysfunctional integration or device.",
- "remove_intro": "If the entity is no longer in use, you can clean it up by removing it.",
- "remove_action": "Remove entity",
- "confirm_remove_title": "Remove entity?",
- "confirm_remove_text": "Are you sure you want to remove this entity?"
+ "no_longer_provided": "This entity is no longer being provided by the {integration} integration. If the entity is no longer in use, delete it in settings."
},
"vacuum": {
"status": "Status",