Skip to content

Commit c3e4719

Browse files
authored
Update readme.md function gotchas (#485)
As discussed in #484 there was an undocumented gotcha. I subsequently realised there is a sub-gotcha on the same theme of ordering.
1 parent 97e17a1 commit c3e4719

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ Remember you can add a `console.log(the_object_you_want_to_inspect)` and see its
798798
- `path: string;` The path of the current function
799799
- `css_vars: HATheme;` The colors set by the active Home Assistant theme (see #ha_theme)
800800

801-
#### Only iniside entities
801+
#### Only inside entities
802802

803803
- `xs: Date[];` Array of timestamps
804804
- `ys: YValue[];` Array of values of the sensor/attribute/statistic
@@ -813,6 +813,8 @@ Remember you can add a `console.log(the_object_you_want_to_inspect)` and see its
813813
- Functions cannot return functions for performance reasons. (feature request if you need this)
814814
- Defaults are not applied to the subelements returned by a function. (feature request if you need this)
815815
- You can get other values from the yaml with the `getFromConfig` parameter, but if they are functions they need to be defined before.
816+
- Any function which uses the result of a filter, needs to be placed in the YAML below the filter. For instance, `name: $ex ys.at(-1)` where the filter is modifying `ys`.
817+
- The same is true of consecutive filters - order matters. This is due to the fact that filters are translated internally to function calls, executed in the order they are parsed.
816818

817819
#### Adding the last value to the entitiy's name
818820

0 commit comments

Comments
 (0)