prefixkit Ask an engineerAsk Support RU

Smart home

Home Assistant template tester

Test a Home Assistant Jinja template without restarting anything: states(), is_state, state_attr, now(), float, int, round, iif and selectattr filters on your own test states. See the result and errors at once.

Examples: · · · · ·

Result

The template runs in the browser on a Jinja-compatible engine with the Home Assistant functions. Rare ones (area_entities, device_attr, relative_time) are not available here: check those in Developer tools → Template.

Cheat sheet

states('sensor.x')the state as a string; "unknown" if there is no such entity
| float(0) / | int(0)to a number; 0 is the fallback if it is not a number (without it you get an error)
is_state('light.x', 'on')compare the state
state_attr('light.x', 'brightness')an attribute
states.light | selectattr('state','eq','on')filter a domain’s entities
iif(cond, 'a', 'b')a short if
now().hour, today_at('22:00')time

In YAML always quote a template: value_template: "{{ … }}". Check a whole file: YAML checker.

Idea?