Math template functions

These template functions provide mathematical operations for your templates. From basic arithmetic helpers to trigonometry, statistics, and value constraining, they let you perform calculations on sensor data, averages across rooms, and more.

Home Assistant extends the Jinja2 template engine with many custom functions, filters, and tests. Each function on this page has its own page with detailed descriptions, parameters, and practical examples.

New to templates? Start with the templating documentation to learn the basics.