Multiply() template filter function

While trying to solve an unrelated problem, I’ve come across several threads in the HA forums referring to a template filter function named multiply() which as its name suggests multiplies the previous number, e.g:

{{ value | multiply(5) }}

A convenient filter overall, but I cannot for the life of me find any documentation whatsoever anywhere on the Internet that even mentions such filter, except for a handfull of comments in the HA forums mentioning it in passing. It works so it’s obviously a real thing.

Is it an HA specific extension? Are there other filters available that aren’t listed in the documentation that I should know?

Can’t say I’ve heard of it. I’ve always just used * n

I’ve seen it but, like you said, can’t find documentation for it (not even in the latest Jinja2 docs).

Just a wild guess but maybe it was included a long time ago and then deprecated in favor of using the asterisk operator (*). So still available but no longer promoted as the way to multiply numbers. :man_shrugging:

I also took a look in the docs and saw no reference to it. Your explanation seems likely.

Does anyone know if there’s an operator or template to apply an exponent? I’ve tried the caret (^) and the filters pow(n), power(n), exp(n), and exponent(n). There doesn’t seem to be anything in the documentation; I’m just hoping that something exists.

Double asterisk.

Screenshot%20from%202019-10-26%2017-48-09

Perfect. Thanks! Is that a python syntax?

Jinja is a templating engine for Python so I suppose, yeah.