Comparison template functions
These template tests let you compare values in your templates. Use them inside if conditions and filters to check equality, order, or membership.
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.
-
Test uality
eqTests if two values are equal. Also known as equalto or ==. -
Test greater than or equal
geTests if a value is greater than or equal to another. Also known as >=. -
Test greater than
gtTests if a value is greater than another. Also known as greaterthan or >. -
Test ss than or equal
leTests if a value is less than or equal to another. Also known as <=. -
Test less than
ltTests if a value is less than another. Also known as lessthan or <. -
Test not equal
neTests if two values are not equal. Also known as !=.