From f3ed0160af785d6ef320abb2ad50c4da6193ef4e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 31 Aug 2023 14:22:39 +0200 Subject: [PATCH] Fix tooltip error for climate charts (#17752) --- src/components/chart/state-history-chart-line.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index 3474c1eb5b..46243893a3 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -137,12 +137,16 @@ export class StateHistoryChartLine extends LitElement { `${context.dataset.label}: ${formatNumber( context.parsed.y, this.hass.locale, - getNumberFormatOptions( - this.hass.states[this.data[context.datasetIndex].entity_id], - this.hass.entities[ - this.data[context.datasetIndex].entity_id - ] - ) + this.data[context.datasetIndex]?.entity_id + ? getNumberFormatOptions( + this.hass.states[ + this.data[context.datasetIndex].entity_id + ], + this.hass.entities[ + this.data[context.datasetIndex].entity_id + ] + ) + : undefined )} ${this.unit}`, }, },