File tree Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Expand file tree Collapse file tree 1 file changed +6
-16
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,6 @@ import { formatTimeWithSeconds } from "../../common/datetime/format_time";
1111import { restoreScroll } from "../../common/decorators/restore-scroll" ;
1212import { fireEvent } from "../../common/dom/fire_event" ;
1313import { computeDomain } from "../../common/entity/compute_domain" ;
14- import { DEFAULT_ENTITY_NAME } from "../../common/entity/compute_entity_name_display" ;
1514import { navigate } from "../../common/navigate" ;
1615import { computeTimelineColor } from "../../components/chart/timeline-color" ;
1716import "../../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 `<butto n
You can’t perform that action at this time.
0 commit comments