Skip to content

Commit f091148

Browse files
committed
better console log example
1 parent 8ef9f25 commit f091148

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

readme.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,8 @@ entities:
417417
# The filters below receive all datapoints as they come from home assistant. Y values are strings or null (unless previously mapped to numbers or any other type)
418418
- map_y: y === "heat" ? 1 : 0 # map the y values of each datapoint. Variables `i` (index), `x`, `state`, `statistic` and `meta` and `vars` are also in scope.
419419
- map_x: new Date(+x + 1000) # map the x coordinate (javascript date object) of each datapoint. Same variables as map_y are in scope
420-
- fn: |- # arbitrary function.
420+
- fn: |- # arbitrary function. Only the keys that are returned are replaced. Returning null or undefined, leaves the data unchanged (useful )
421+
421422
({xs, ys, meta, states, statistics}) => {
422423
# either statistics or states will be available, depending on if "statistics" are fetched or not
423424
# attributes will be available inside states only if an attribute is picked in the trace
@@ -502,9 +503,9 @@ or alternatively,
502503
- entity: sensor.temperature_in_celsius
503504
statistics: mean
504505
filters:
506+
- fn: console.log # open the devtools console to see the data
505507
- fn: |-
506508
(params) => {
507-
console.log(params);
508509
const ys = [];
509510
debugger;
510511
for (let i = 0; i < params.statistics.length; i++){

0 commit comments

Comments
 (0)