Skip to content

Commit

Permalink
fix(func): Filter null values in diff
Browse files Browse the repository at this point in the history
  • Loading branch information
RomRider committed Jan 31, 2021
1 parent f360083 commit cfe736c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions .devcontainer/ui-lovelace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ views:
group_by:
duration: 10min
func: first
- entity: sensor.random0_100
curve: smooth
name: DIFF
type: line
show:
as_duration: year
group_by:
duration: 10min
func: diff

- type: custom:apexcharts-card
graph_span: 4h
Expand Down
5 changes: 3 additions & 2 deletions src/graphEntry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,9 @@ export default class GraphEntry {
}

private _diff(items: EntityCachePoints): number | null {
const first = this._first(items);
const last = this._last(items);
const noNulls = this._filterNulls(items);
const first = this._first(noNulls);
const last = this._last(noNulls);
if (first === null || last === null) {
return null;
}
Expand Down

0 comments on commit cfe736c

Please sign in to comment.