From c12e6662dd199eb480303f345c0fa8f6a744b2e6 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Tue, 25 Oct 2022 22:36:20 +0200 Subject: [PATCH] Add week period to statistics card (#14162) --- src/data/recorder.ts | 2 +- .../editor/config-elements/hui-statistics-graph-card-editor.ts | 3 ++- src/translations/en.json | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/data/recorder.ts b/src/data/recorder.ts index 5f7467ae33..e711cd4670 100644 --- a/src/data/recorder.ts +++ b/src/data/recorder.ts @@ -110,7 +110,7 @@ export const fetchStatistics = ( startTime: Date, endTime?: Date, statistic_ids?: string[], - period: "5minute" | "hour" | "day" | "month" = "hour", + period: "5minute" | "hour" | "day" | "week" | "month" = "hour", units?: StatisticsUnitConfiguration ) => hass.callWS({ diff --git a/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts index f068a96c43..d8af7c848d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts @@ -59,6 +59,7 @@ const cardConfigStruct = assign( literal("5minute"), literal("hour"), literal("day"), + literal("week"), literal("month"), ]) ), @@ -67,7 +68,7 @@ const cardConfigStruct = assign( }) ); -const periods = ["5minute", "hour", "day", "month"] as const; +const periods = ["5minute", "hour", "day", "week", "month"] as const; const stat_types = ["mean", "min", "max", "sum", "state"] as const; @customElement("hui-statistics-graph-card-editor") diff --git a/src/translations/en.json b/src/translations/en.json index c185daa664..338e655df2 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -4020,6 +4020,7 @@ "hour": "Hour", "day": "Day", "month": "Month", + "week": "Week", "5minute": "5 Minutes" }, "pick_statistic": "Add a statistic",