Add option to display state

This commit is contained in:
Erik 2022-09-21 14:17:23 +02:00 committed by Bram Kragten
parent 0f534423a4
commit 87dedeb9b3
No known key found for this signature in database
GPG Key ID: FBE2DFDB363EF55B
3 changed files with 5 additions and 1 deletions

View File

@ -38,6 +38,7 @@ export const statTypeMap: Record<ExtendedStatisticType, StatisticType> = {
max: "max",
sum: "sum",
sum_rel: "sum",
state: "sum",
};
@customElement("statistics-chart")
class StatisticsChart extends LitElement {

View File

@ -39,6 +39,7 @@ import { deepEqual } from "../../../../common/util/deep-equal";
import { statTypeMap } from "../../../../components/chart/statistics-chart";
const statTypeStruct = union([
literal("state"),
literal("sum"),
literal("sum_rel"),
literal("min"),
@ -66,7 +67,7 @@ const cardConfigStruct = assign(
);
const periods = ["5minute", "hour", "day", "month"] as const;
const stat_types = ["mean", "min", "max", "sum", "sum_rel"] as const;
const stat_types = ["mean", "min", "max", "sum", "sum_rel", "state"] as const;
@customElement("hui-statistics-graph-card-editor")
export class HuiStatisticsGraphCardEditor

View File

@ -517,6 +517,7 @@
"min": "min",
"max": "max",
"mean": "mean",
"state": "state",
"sum": "sum",
"sum_rel": "change"
}
@ -3970,6 +3971,7 @@
"mean": "Mean",
"min": "Min",
"max": "Max",
"state": "State",
"sum": "Sum (absolute)",
"sum_rel": "Change"
},