From 3d2734eb888034c50271faa93c48e3437436747e Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Thu, 6 Jul 2023 00:46:42 -0700 Subject: [PATCH] Fix sensor card to not crash when it finds no state history (#17181) --- src/panels/lovelace/common/graph/coordinates.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/panels/lovelace/common/graph/coordinates.ts b/src/panels/lovelace/common/graph/coordinates.ts index b63c61af05..56f5251965 100644 --- a/src/panels/lovelace/common/graph/coordinates.ts +++ b/src/panels/lovelace/common/graph/coordinates.ts @@ -119,6 +119,9 @@ export const coordinatesMinimalResponseCompressedState = ( detail: number, limits?: { min?: number; max?: number } ): number[][] | undefined => { + if (!history) { + return undefined; + } const numericHistory: NumericEntityHistoryState[] = history.map((item) => ({ state: Number(item.s), // With minimal response and compressed state, we don't have last_changed,