diff --git a/src/components/chart/state-history-chart-timeline.ts b/src/components/chart/state-history-chart-timeline.ts index 538afd6b34..fd98de2125 100644 --- a/src/components/chart/state-history-chart-timeline.ts +++ b/src/components/chart/state-history-chart-timeline.ts @@ -21,9 +21,9 @@ let colorIndex = 0; export const getStateColorToken = ( stateString: string, - entityState: HassEntity + entityState?: HassEntity ) => { - if (!stateActive(entityState, stateString)) { + if (!entityState || !stateActive(entityState, stateString)) { return `disabled`; } const color = stateColor(entityState, stateString); @@ -35,8 +35,8 @@ export const getStateColorToken = ( const getColor = ( stateString: string, - entityState: HassEntity, - computedStyles: CSSStyleDeclaration + computedStyles: CSSStyleDeclaration, + entityState?: HassEntity ) => { const stateColorToken = getStateColorToken(stateString, entityState); @@ -273,8 +273,8 @@ export class StateHistoryChartTimeline extends LitElement { label: locState, color: getColor( prevState, - this.hass.states[stateInfo.entity_id], - computedStyles + computedStyles, + this.hass.states[stateInfo.entity_id] ), }); @@ -291,8 +291,8 @@ export class StateHistoryChartTimeline extends LitElement { label: locState, color: getColor( prevState, - this.hass.states[stateInfo.entity_id], - computedStyles + computedStyles, + this.hass.states[stateInfo.entity_id] ), }); } diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index f28edba8dc..105fd43c63 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -48,7 +48,7 @@ export class MoreInfoHistory extends LitElement { return html``; } - return html`${isComponentLoaded(this.hass, "history") + return html` ${isComponentLoaded(this.hass, "history") ? html`