diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts
index 9df9d29514..eb5f3d857d 100644
--- a/src/dialogs/more-info/ha-more-info-dialog.ts
+++ b/src/dialogs/more-info/ha-more-info-dialog.ts
@@ -20,7 +20,9 @@ import { HomeAssistant } from "../../types";
import {
EDITABLE_DOMAINS_WITH_ID,
EDITABLE_DOMAINS,
- DOMAINS_MORE_INFO_NO_HISTORY,
+ DOMAINS_WITH_MORE_INFO,
+ computeShowHistoryComponent,
+ computeShowLogBookComponent,
} from "./const";
import "./controls/more-info-default";
import "./ha-more-info-info";
@@ -47,13 +49,11 @@ export class MoreInfoDialog extends LitElement {
public showDialog(params: MoreInfoDialogParams) {
this._entityId = params.entityId;
- if (params.tab) {
- this._currTab = params.tab;
- }
if (!this._entityId) {
this.closeDialog();
return;
}
+ this._currTab = params.tab || "info";
this.large = false;
}
@@ -216,7 +216,13 @@ export class MoreInfoDialog extends LitElement {
const domain = computeDomain(entityId);
const tabs: Tab[] = ["info"];
- if (!DOMAINS_MORE_INFO_NO_HISTORY.includes(domain)) {
+ // Info and history are combined in info when there are no
+ // dedicated more-info controls. If not combined, add a history tab.
+ if (
+ DOMAINS_WITH_MORE_INFO.includes(domain) &&
+ (computeShowHistoryComponent(this.hass, entityId) ||
+ computeShowLogBookComponent(this.hass, entityId))
+ ) {
tabs.push("history");
}
@@ -299,10 +305,6 @@ export class MoreInfoDialog extends LitElement {
--mdc-dialog-max-height: calc(100% - 72px);
}
- ha-icon-button[slot="navigationIcon"] {
- display: none;
- }
-
.main-title {
overflow: hidden;
text-overflow: ellipsis;
@@ -319,13 +321,6 @@ export class MoreInfoDialog extends LitElement {
ha-dialog[data-domain="camera"] {
--dialog-content-padding: 0;
}
-
- state-card-content,
- ha-more-info-history,
- ha-more-info-logbook:not(:last-child) {
- display: block;
- margin-bottom: 16px;
- }
`,
];
}
diff --git a/src/dialogs/more-info/ha-more-info-info.ts b/src/dialogs/more-info/ha-more-info-info.ts
index 0167943d34..d66adaed41 100644
--- a/src/dialogs/more-info/ha-more-info-info.ts
+++ b/src/dialogs/more-info/ha-more-info-info.ts
@@ -1,10 +1,15 @@
-import { LitElement, html } from "lit";
+import { LitElement, html, css } from "lit";
import { customElement, property } from "lit/decorators";
import { computeDomain } from "../../common/entity/compute_domain";
import { removeEntityRegistryEntry } from "../../data/entity_registry";
import type { HomeAssistant } from "../../types";
import { showConfirmationDialog } from "../generic/show-dialog-box";
-import { DOMAINS_NO_INFO } from "./const";
+import {
+ computeShowHistoryComponent,
+ computeShowLogBookComponent,
+ DOMAINS_NO_INFO,
+ DOMAINS_WITH_MORE_INFO,
+} from "./const";
import "./ha-more-info-history";
import "./ha-more-info-logbook";
@@ -29,6 +34,20 @@ export class MoreInfoInfo extends LitElement {
.hass=${this.hass}
>
`}
+ ${DOMAINS_WITH_MORE_INFO.includes(domain) ||
+ !computeShowHistoryComponent(this.hass, entityId)
+ ? ""
+ : html``}
+ ${DOMAINS_WITH_MORE_INFO.includes(domain) ||
+ !computeShowLogBookComponent(this.hass, entityId)
+ ? ""
+ : html``}