Is there a list of global objects in templates?

I’m new to Home Assistant and I’m currently setting up some automations to make it interact with other systems. Usually this means I will have an action in an automation with a data_payload where I’m writing my “scripts”, for example crafting a response to the “how is the weather” voice question. From various resource like this Discourse and the Rhasspy Discourse I was able to collect a list of global objects that are available in templates, like:

  • states
  • trigger
  • now()

I wonder if there is a comprehensive list, either in the docs or in the source of what other global objects are available to templates?

Another resource:

That one has quite a few, but trigger is missing.

If you want to know more about the trigger variable, refer to the documentation:


This list of “global objects” you’re looking for doesn’t exist for the simple reason that you invented the term “global objects” and now expect to find this fiction documented somewhere.

Home Assistant supports the use of the Jinja2 templating language. However, it doesn’t support all of Jinja2’s functionality plus it adds custom extensions to it. In addition, some of the python language can be used as well. Therefore, what’s available for templating is the intersection of three resources: Jinja2, python, and custom extensions. They are used to manipulate data provided by Home Assistant’s State Objects.

Oh, automation/templating and templating are two different pages, that’s the first thing I didn’t realize when scouring the documentation.

Sure, I just made up the term “global objects” for those “things” that you can put for example between {{ and }}. You might call them “variables”, but now() isn’t really a variable so I tried to avoid that term. It’s still a valid question whether they are listed anywhere, isn’t it? They don’t come from Jinja2, so they must come from Home Assistant.

The following template contains aspects of Jinja2, python, and custom functions only found in Home Assistant.

{{ state_attr('sensor.light_level', 'friendly_name')[:-5] | lower }} 

You won’t find documentation that explains all three of them in one place.