Skip to content

Commit c01fbf5

Browse files
authored
Revert "Use entity name for activity/logbook renderer" (#28098)
1 parent 5c8da28 commit c01fbf5

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

src/panels/logbook/ha-logbook-renderer.ts

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { formatTimeWithSeconds } from "../../common/datetime/format_time";
1111
import { restoreScroll } from "../../common/decorators/restore-scroll";
1212
import { fireEvent } from "../../common/dom/fire_event";
1313
import { computeDomain } from "../../common/entity/compute_domain";
14-
import { DEFAULT_ENTITY_NAME } from "../../common/entity/compute_entity_name_display";
1514
import { navigate } from "../../common/navigate";
1615
import { computeTimelineColor } from "../../components/chart/timeline-color";
1716
import "../../components/entity/state-badge";
@@ -464,24 +463,15 @@ class HaLogbookRenderer extends LitElement {
464463
entityName: string | undefined,
465464
noLink?: boolean
466465
) {
467-
if (!entityId) {
468-
return entityName || "";
469-
}
470-
471-
const stateObj = this.hass.states[entityId];
472-
const hasState = Boolean(stateObj);
473-
474-
const displayName = hasState
475-
? this.hass.formatEntityName(stateObj, DEFAULT_ENTITY_NAME) ||
476-
entityName ||
477-
stateObj.attributes.friendly_name ||
478-
entityId
479-
: entityName || entityId;
480-
466+
const hasState = entityId && entityId in this.hass.states;
467+
const displayName =
468+
entityName ||
469+
(hasState
470+
? this.hass.states[entityId].attributes.friendly_name || entityId
471+
: entityId);
481472
if (!hasState) {
482473
return displayName;
483474
}
484-
485475
return noLink
486476
? displayName
487477
: html`<button

0 commit comments

Comments
 (0)