Provided Home Assistant template functions, filters, and tests
How did those functions break upβ They stopped calling each other π₯
Spook provides quite a lot of new template functions, filters, and tests to the Home Assistant template engine. This reference page lists them all and points you to the right documentation for each of those template functions.
FlattenΒΆ
Flatten a lists of lists.
{{ flatten(["a", ["b", ["c"]]]) }}
{{ flatten(["a", ["b", ["c"]]], levels=1) }}
documentation π
MD5ΒΆ
Calculate the MD5 hash of a given value.
{{ md5("hash me") }}
documentation π
SHA1ΒΆ
Calculate the SHA1 hash of a given value.
{{ sha1("hash me") }}
documentation π
SHA256ΒΆ
Calculate the SHA256 hash of a given value.
{{ sha256("hash me") }}
documentation π
SHA512ΒΆ
Calculate the SHA512 hash of a given value.
{{ sha512("hash me") }}
documentation π
ShuffleΒΆ
Shuffles a list of items.
{{ shuffle(["a", "b", "c"]) }}
{{ shuffle(["a", "b", "c"], seed=42) }}
documentation π
TypeofΒΆ
Reveals the type of a given value.
{{ typeof("Spook") }}
{{ now() | typeof }}
documentation π
Unix file name pattern filteringΒΆ
Filter a lists of texts against a pattern.
{{ fnmatch_filter(["Spook", "Ghost], "Sp*k") }}
{{ fnmatch_filter(["Spook", "Spook2", "Ghost"], "Sp*") }}
documentation π
Unix file name pattern matchingΒΆ
Match text or a lists of texts against a pattern.
{{ fnmatch("Spook", "Sp*k") }}
{{ fnmatch(["Spook", "Spook2"], "Sp*") }}
documentation π