Fix sensor card to not crash when it finds no state history (#17181)

This commit is contained in:
karwosts 2023-07-06 00:46:42 -07:00 committed by GitHub
parent 9ac3f745b3
commit 3d2734eb88
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,