Skip to content

Commit

Permalink
Merge pull request #1 from ka0n/dev
Browse files Browse the repository at this point in the history
Add change type for statistics
  • Loading branch information
ka0n authored Jun 1, 2023
2 parents 1b63c0f + 6bcd418 commit 1e56e0e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ series:

| Name | Type | Default | Since | Description |
| ---- | :--: | :-----: | :---: | ----------- |
| `type` | string | `mean` | v2.0.0 | Type of long term statistic to pull. Can be one of `min`, `max`, `mean`, `sum` or `state` |
| `type` | string | `mean` | v2.0.0 | Type of long term statistic to pull. Can be one of `min`, `max`, `mean`, `sum` `state` or `change` |
| `period` | string | `hour` | v2.0.0 | Period of statistics to pull. Can be one of `5minute`, `hour`, `day` or `month` |
| `align` | string | `middle` | v2.0.0 | Align the data points to the `start`, `end` or `middle` of the period of the statistics |

Expand Down
2 changes: 1 addition & 1 deletion src/types-config-ti.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const ChartCardAllSeriesExternalConfig = t.iface([], {
"invert": t.opt("boolean"),
"data_generator": t.opt("string"),
"statistics": t.opt(t.iface([], {
"type": t.opt(t.union(t.lit('mean'), t.lit('max'), t.lit('min'), t.lit('sum'), t.lit('state'))),
"type": t.opt(t.union(t.lit('mean'), t.lit('max'), t.lit('min'), t.lit('sum'), t.lit('state'), t.lit('change'))),
"period": t.opt("StatisticsPeriod"),
"align": t.opt(t.union(t.lit('start'), t.lit('end'), t.lit('middle'))),
})),
Expand Down
2 changes: 1 addition & 1 deletion src/types-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface ChartCardAllSeriesExternalConfig {
invert?: boolean;
data_generator?: string;
statistics?: {
type?: 'mean' | 'max' | 'min' | 'sum' | 'state';
type?: 'mean' | 'max' | 'min' | 'sum' | 'state' | 'change';
period?: StatisticsPeriod;
align?: 'start' | 'end' | 'middle';
};
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export interface StatisticValue {
min: number | null;
sum: number | null;
state: number | null;
change: number | null;
}

export type HassHistory = Array<[HassHistoryEntry] | undefined>;
Expand Down

0 comments on commit 1e56e0e

Please sign in to comment.